F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Problem F. Travel Through Time

Time 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
1 9 2 5 5 6 3 1 10 5 6 1 0 5 2 5 0 4 0 5 7
 

Sample Output
No Yes No Yes Yes
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 10:27:19, Gzip enabled