atcoder#ABC189E. [ABC189E] Rotate and Flip
[ABC189E] Rotate and Flip
Score : points
Problem Statement
There are pieces on a two-dimensional plane. The coordinates of Piece are . There may be multiple pieces at the same coordinates.
We will do operations , one by one. There are four kinds of operations, described below along with their formats in input.
1
:Rotate every piece degrees clockwise about the origin;2
:Rotate every piece degrees counterclockwise about the origin;3 p
:Move each piece to the point symmetric to it about the line ;4 p
:Move each piece to the point symmetric to it about the line .
You are given queries. In the -th query, given two integers and , print the coordinates of Piece just after the -th operation. Here, the moment just before the -st operation is considered to be the moment just after "the -th operation".
Constraints
- All values in input are integers.
- is in the format of one of the four kinds of operations.
- In an operation with the form
3 p
or4 p
, .
Input
Input is given from Standard Input in the following format:
Output
Print the response to each query in its own line: the - and -coordinates, in this order, with space in between.
1
1 2
4
1
3 3
2
4 2
5
0 1
1 1
2 1
3 1
4 1
1 2
2 -1
4 -1
1 4
1 0
Initially, the only piece - Piece - is at . Each operation moves the piece as follows: .
2
1000000000 0
0 1000000000
4
3 -1000000000
4 -1000000000
3 1000000000
4 1000000000
2
4 1
4 2
5000000000 4000000000
4000000000 5000000000