Sequence and Queries 32
Time limit10sMemory limit512 MB
Maintain a sequence under point updates and answer whether it can be split into contiguous blocks whose xors all lie in a small given set.
- Level
Hard9 of 10
- Topics
- Dynamic programming, Prefix sum, Bit manipulation, Segment tree
- Solved
- No attempts yet
Problem
A sequence of length is given. Write a program that performs the following queries.
-
1 x v: replace with . -
2 k b1 ... bk: if the sequence can be partitioned into intervals satisfying the conditions below, print "TAK"; otherwise print "NIE".- Every element must belong to exactly one interval.
- The intervals must not overlap.
- The xor of all elements in each interval must equal one of .
Input
The first line contains the size of the sequence, . ()
The second line contains . ()
The third line contains the number of queries, . ()
Each of the next lines contains one query. (, , )
The number of type 1 queries does not exceed 400,000, and the sum of over all type 2 queries does not exceed 100,000.
Output
Print the result of each type 2 query.