#P6526. 「Wdoi-1」四重存在
「Wdoi-1」四重存在
Background
Flandre Scarlet's spell card taboo "Quadruple Existence" can create phantoms of Flandre.
But Flandre is not satisfied with this.
Problem Description
The basement where Flandre is can be abstracted as a huge 2D Cartesian coordinate system. Flandre will perform actions. Each action is as follows:
-
1 x y vmeans Flandre summons a new phantom at coordinate , and this phantom has units of power. -
2means query, among the existing phantoms, what the maximum value of "Flandre Distance" is. -
3 ameans query: if the -th summoned phantom is ignored, then among the remaining phantoms, what the maximum value of "Flandre Distance" is.
Note:
Let the -th summoned phantom have index , coordinate , and power .
The "Flandre Distance" between two phantoms with indices is .
In particular, the "Flandre Distance" from phantom to itself is .
In operation , the -th summoned phantom only does not participate in this query, rather than being removed.
Input Format
The first line contains an integer , the number of operations.
Then follow lines, each containing several integers. The input format is the same as in the problem description.
Note: Since Flandre's emotions are unstable, in operation , the actual input is:
$$x'=x \operatorname{ xor } (\text{lastans} \bmod 3)$$$$y'=y \operatorname{ xor } (\text{lastans} \bmod 3)$$$$v'=v \operatorname{ xor } (\text{lastans} \bmod 3)$$The meanings of the operations are:
-
denotes the bitwise XOR operation.
-
denotes the answer of the previous operation or . Initially, .
Output Format
Output several lines in total, each containing one integer, which is the answer for each operation or .
6
1 4 -4 0
1 -3 -1 0
1 -1 -1 0
2
3 2
3 3
10
8
10
Hint
Constraints and Notes
"This problem uses bundled testdata: a subtask is accepted if and only if all test points in that subtask are accepted".
| Subtask ID | Special Property | Score | |
|---|---|---|---|
| None | |||
| A | |||
| None | |||
Property A means there is no operation .
For of the data, . Let the number of phantoms at some moment be , then .
The testdata guarantees that any two phantoms have different coordinates, and that at least points have been inserted when querying or .
Translated by ChatGPT 5