#P14005. 「florr IO Round 1」棋盘游戏

    ID: 13732 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>洛谷原创Special Judge洛谷月赛

「florr IO Round 1」棋盘游戏

Description

Little A's chessboard is an infinite plane Cartesian coordinate system, where each point can be represented as (x,y)(x, y). Initially, there is exactly one black piece, and all other pieces are white. Each time, Little B can flip the colors of five points in one of the following two shapes:

$$\begin{aligned} &\huge\tt\ \ O\\ &\huge\tt OO\\ &\huge\tt OO \end{aligned}$$$$\begin{aligned} &\huge\tt O\\ &\huge\tt OO\\ &\huge\tt OO \end{aligned}$$

Little A wants to know where the black piece he placed at the beginning could be. Can you help him?

If there are multiple answers, output any one of them.

Input Format

The first line contains an integer nn representing the current number of black pieces.

The next nn lines each contain two integers xi,yix_i, y_i, representing the position of the ii-th black piece. It is guaranteed that these positions are all distinct.

Output Format

Output one line with two integers, each with absolute value not exceeding 10910^9, representing the coordinates where Little A initially placed the black piece. It is guaranteed that there is a solution.

4
1 1
1 2
2 1
2 2

2 3

Hint

Sample Explanation

It can be achieved by one move from Little B:

Flip (2,3),(2,2),(1,2),(2,1),(1,1)(2,3), (2,2), (1,2), (2,1), (1,1), and now the four points (2,2),(1,2),(2,1),(1,1)(2,2), (1,2), (2,1), (1,1) are black pieces. (This corresponds to the first shape in the problem description above.)

If you output (3,2)(3,2), that is also correct, because it is possible that Little B flipped (2,3),(2,2),(1,2),(2,1),(1,1)(2,3), (2,2), (1,2), (2,1), (1,1), which corresponds to the second shape in the problem description above.

Data Range

  • For 30%30\% of the data, n=1n=1.
  • For 100%100\% of the data, 1n1051 \le n \le 10^5, xi,yi109|x_i|, |y_i| \le 10^9.

Translated by ChatGPT 4.1