|
||||||||||
Problem F. Travel Through TimeTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 74 Accepted Submission(s): 10 Problem Description Kazari, a girl who can travel through time, is playing chess on a number axis. At the very beginning, there is a chess at position $0$. Then $q$ events occurs in sequence, each of which belongs to one of the following five types: * 1 x She places a chess at position $x$. * 2 x She places a chess at position $z$ if there exists chess at position $y$ where $|y - z| \le x$. * 3 l r She reverses $[l, r]$, i.e., each chess at position $x$ $(l \le x \le r)$ moves to position $r + l - x$. * 4 x She travels to the time right after the $x$-th event. * 5 x She checks if there exists chess at position $x$. During the game, Kazari will tell you the $q$ events in sequence. You are curious about the checking results of type-5 events, and decide to work out it timely according to the given information. In order to keep your algorithm online, the input has been encrypted. You should `XOR` the current number of type-5 events whose result is `Yes` to each $l, r$ and $x$, to get the real input. Input The first line of the input contains an integer $T$ denoting the number of test cases. Each test case starts with an integer $q$ $(1 \le q \le 50000, \sum{q} \le 10 ^ 6)$ denoting the number of events. Each of next $q$ lines contains an encrypted event, remember to decrypt it first! * $0 \le x \le 10 ^ 6$ for type-2 events * $|x| \le 10 ^ {12}$ for type-1, type-5 events * $|l|, |r| \le 10 ^ {12}, l \le r$ for type-3 events * It is guaranteed that $x$ is less than the current number of events for type-4 events. Output For each test case, print `Yes` or `No` for each type-5 event. Sample Input
Sample Output
Source | ||||||||||
|