409780: GYM103741 J Sequence

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Walk_alone loves sequences. For a sequence $$$a_1,a_2,\dots,a_n$$$ of length $$$n$$$, he defines $$$A_i\ (1\le i< n)$$$ as

$$$$$$A_i=\bigoplus_{j=1}^i \bigoplus_{k=i+1}^n a_j \,\&\, a_k$$$$$$

where $$$\&$$$ represents the bitwise AND, and $$$\oplus$$$ means bitwise XOR.

Now Walk_alone has an initially empty sequence. He will do $$$q$$$ operations to this sequence, and there will be two types of operations:

  • 1 x: add an element $$$x\ (0\le x<2^{20})$$$ to the back of the sequence.
  • 2: output $$$\max_{1\le i<n}A_i$$$ where $$$n$$$ is the length of sequence $$$a$$$. The answer is $$$0$$$ if $$$n<2$$$.
Input

The first line of the input contains one integer $$$q\ (1 \leq q \leq 10^5)$$$, indicating the number of operations.

Each of the next $$$q$$$ lines will contain one kind of operations described above. It is guaranteed that $$$0\le x<2^{20}$$$ for every operation of the first type.

Output

For each operation of the second type, output the answer in a line.

ExampleInput
11
1 6
2
1 7
2
1 13
1 4
1 14
2
1 14
1 10
2
Output
0
6
8
12

Source/Category

加入题单

算法标签: