#P9430. [NAPC-#1] Stage2 - Darkness
[NAPC-#1] Stage2 - Darkness
Background
Problem Description
There are armies distributed in different places, which can be viewed on a 2D Cartesian coordinate system. They are all under kid’s unified command, and kid issues a total of commands.
The commands are as follows:
1 p qmeans moving the position of every army from to .2 imeans applying an axis symmetry (reflection) of the position of the -th army over the line (i.e., swapping the values of and ).3 imeans querying the current position of the -th army (i.e., output the current and ).
Note that commands 1 and 2 operate on different targets: the former affects all armies, while the latter affects only one army.
kid could have used binoculars to see directly, but it is too dark, so he asks you to write a program to tell him.
Input Format
The first line contains two positive integers .
The next lines: the -th line contains two integers , representing the initial position of the -th army .
The next lines: each line contains two or three integers, representing a command issued by kid. Specifically, each command starts with a positive integer indicating the command type:
- If , then two integers follow, meaning moving the position of every army from to .
- If , then a positive integer follows, meaning applying an axis symmetry of the -th army over .
- If , then a positive integer follows, meaning querying the current position of the -th army.
Output Format
For each 3 command issued by kid, output one line with two integers , representing the current position of the -th army.
3 7
1 2
2 5
6 2
3 2
1 1 4
3 3
2 3
3 1
1 -9 -1
3 3
2 5
7 6
2 6
-3 6
Hint
Constraints
This problem has test points, and each test point has equal score.
- For of the testdata, .
- For another of the testdata, it is guaranteed that there are no
2commands.
For of the testdata, , , , , .
Sample Explanation
| Time | |||
|---|---|---|---|
| Initial | |||
| After the 2nd command | |||
| After the 4th command | |||
| After the 6th command |
Translated by ChatGPT 5
