Curling
면접 대비시간 제한1초메모리 제한2048 MB
10개 프레임 각각에 대해 빨간 돌과 노란 돌의 좌표가 주어질 때, 버튼에 가장 가까운 돌을 가진 팀이 그 프레임의 점수를 얻도록 계산하여 두 팀의 최종 점수를 출력한다.
문제
Curling is a winter sport. Players on two teams alternate sliding eight “stones” each of their color, red or yellow, down an ice sheet, trying to get their stones as close to the “button” as possible. The ice sheet is feet long by feet wide. In inches, that’s . The button is feet from the end, in the center, feet from either side. That’s at location in inches.

Each game has ten frames. In each frame, the teams alternate sliding their stones down the ice sheet, trying to get their stones closest to the button (or knocking their opponent’s stones away from the button). Whichever team has the closest stone to the button gets all the points in a frame. They get one point for every stone of theirs that is closer to the button than any of their opponent’s stones. It is possible for stones to completely exit the ice sheet.
Given the positions of the stones, in inches, after each of the ten frames, and assuming that the button is at , compute the final score of the game.
입력
The input consists of exactly lines, in pairs. Each pair consists of the positions of the red stones followed by the positions of the yellow stones for one frame.
Each line begins with an integer (), which is the number of stones that remain on the ice sheet, followed by ordered pairs of integers () and (), which are the positions of each stone that remains on the sheet, in inches. It is guaranteed that no two stones in a frame will be at the same distance from the button.
출력
Output two integers on a single line, which are the red team’s score followed by the yellow team’s score.