#P5927. [JSOI2010] 下棋问题
[JSOI2010] 下棋问题
Description
This game is played by two players, A and B, who take turns placing pieces on the grid intersection points of a square chessboard. The coordinates of a grid intersection point are written as , where represents the point at the bottom-left corner of the board.
No two pieces may be placed on the same coordinate. Each time a new piece is added, the counter on the board automatically computes the number of unblocked squares that can be formed by the pieces currently on the board.
An unblocked square means a square defined by any two pieces such that the interior of the square contains no other pieces. After each move, the number of unblocked squares computed is the score obtained for placing that piece. Each player's total score is the sum of the scores for all pieces they have placed.
Write a program to compute the cumulative total scores of players A and B.
Input Format
The first line contains a single integer , indicating that a total of pieces are placed in this game.
The next lines each contain two integers, in order, representing the positions where these pieces are placed.
Output Format
Output two integers, representing the cumulative scores of the two players in this game. A's score comes first, and B's score comes second, separated by a single space.
4
2 3
3 4
1 2
4 1
2 6
Hint
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号