P26931 [AtCoder] Mole
NOI
题目描述

Problem Description

A portrait of Takahashi was drawn on a 2D plane. The portrait includes the right eye, the left eye, and $ N $ moles.

  • The coordinates of the right eye are $ (-E, 0) $ and the left eye are $ (E, 0) $ where $ E > 0 $
  • The coordinates of the $ i $-th mole are $ (A_i, B_i) $

A mischievous Aoki moved the portrait (without flipping it) by performing a translation and a rotation.

As a result,

  • The coordinates of the right eye became $ (x_1, y_1) $ and the left eye became $ (x_2, y_2) $
  • The coordinates of the $ i $-th mole became $ (a_i, b_i) $

Given the coordinates of the eyes and moles after the movement, find the coordinates of the moles before the movement. That is, find $(A_1, B_1), \dots, (A_N, B_N)$.

Note that the coordinates of the eyes before the movement, i.e., $ E $, are not given.

Input Format

The input is given from the standard input in the following format:

$ N $ $ x_1 $ $ y_1 $ $ x_2 $ $ y_2 $ $ a_1 $ $ b_1 $ $ : $ $ a_N $ $ b_N $

Output Format

The output consists of $ N $ lines. The $ i $-th line should contain the coordinates of the $ i $-th mole before the movement in the following format. The output is considered correct if the absolute or relative error of each value is within $ 10^{-5} $ of the expected answer.

$ A_1 $ $ B_1 $ $ : $ $ A_N $ $ B_N $

Sample Input and Output

Sample Input #1

2
5 0
-5 0
-1 3
2 4

Sample Output #1

1 -3
-2 -4

Sample Input #2

4
4 4
12 10
12 4
8 7
-4 -2
100 10

Sample Output #2

1.4 -4.8
0 0
-15 0
75.4 -52.8

Sample Input #3

10
-40336 -25353
25518 98473
-66200 57666
23235 -64774
56870 -67151
-99509 73639
39965 -61027
-54385 -34598
-57063 14129
63186 -88708
88770 85106
-92520 69200

Sample Output #3

-8970.87249328212 61817.21737274555
-75079.28924877638 -74637.35403870217
-61384.55754506934 -105449.9760881721
-10508.55928227892 98726.04733711783
-63915.43362406853 -87648.93490309674
-84883.41976667292 8062.914405771756
-43119.58914921946 33307.21406245974
-77451.63868397648 -121148.543178062
88022.56926540422 -62121.98851386775
-11146.07084342446 90471.08392051774

Notes/Hints

Note

Discussion about this problem is prohibited until 2021/7/17 18:00 JST. If any discussion occurs, legal action may be taken. It is okay to publish the total score or certification level after the exam, but please refrain from sharing information about which problems were solved.

Constraints

  • $1 \leq N \leq 2 \times 10^5$
  • $-10^5 \leq x_i, y_i, a_i, b_i \leq 10^5$
  • $ E > 0 $
  • $(x_1, y_1), (x_2, y_2), (a_1, b_1), \dots, (a_N, b_N)$ are distinct.
  • $(-E, 0) \neq (x_1, y_1)$ or $(E, 0) \neq (x_2, y_2)$
  • All values included in the input are integers.

Sample Explanation 1

The input provides the coordinates of the eyes and moles after the movement.

Sample Explanation 2

Note that although the input values are all integers, the output values and $ E $ may not be integers.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 5 0 -5 0 -1 3 2 4
样例输出
1 -3 -2 -4