Parenthesis sequence
题号:NC210598
时间限制:C/C++/Rust/Pascal 6秒,其他语言12秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

You are given a sequence representing a parenthesis sequence. When , it means there is a left parenthesis(in -th position. When , it means there is a right parenthesis)in -th position. There is also a weight sequence .

For a given parenthesis sequence, you get a unique sequence by deleting substring()until no matching parenthesis left. We call it as the unmatched parenthesis sequence. For example, the parenthesis sequence is)(()(, its unmatched parenthesis sequence is)((, where the position is .

There are operations in three types:

  • 1 x y, change to , and to .

  • 2 l r, For those such that is an unmatched parenthesis in , you are asked to calculate the and of all . You only need to output the of the two results. Assume and if there's no such .

    For two unsigned int , of them is~(a&b)(in C++ code). For a sequence , are computed from left to right. That is, . The result is .

  • 3 l r, swap with , swap with .

输入描述:

The first line contains two integers .
Each line of the following n lines contains two integers .
Each line of the following m lines contains an operation : , , .

输出描述:

For each of the second operation, output the answer.
示例1

输入

复制
10 10
0 1
1 9
1 2
0 5
1 1
0 6
1 1
0 4
0 8
1 7
2 5 7
3 1 10
1 1 3
2 1 3
3 2 9
3 4 10
3 7 8
1 10 2
3 3 4
2 5 7

输出

复制
4294967295
4294967284
4294967281