Hide

Problem E
Curling

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 $138$ feet long by $14$ feet wide. In inches, that’s $1\, 656 \times 168$. The button is $12$ feet from the end, in the center, $7$ feet from either side. That’s at location $(144,84)$ in inches.

\includegraphics[width=\linewidth ]{rink-size.png}

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 $(144,84)$, compute the final score of the game.

Input

The input consists of exactly $20$ lines, in $10$ 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 $n$ ($0 \le n \le 8$), which is the number of stones that remain on the ice sheet, followed by $n$ ordered pairs of integers $x$ ($0 \le x \le 1\, 656$) and $y$ ($0 \le y \le 168$), 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

Output two integers on a single line, which are the red team’s score followed by the yellow team’s score.

Sample Input 1 Sample Output 1
7 1627 63 1506 128 338 123 1035 64 1350 11 275 74 560 53
8 1500 32 1015 96 524 160 1578 160 28 112 1383 147 165 10 1334 167
8 385 75 807 141 903 91 1589 8 1091 68 398 24 1366 95 351 123
6 1003 68 560 149 147 117 779 12 595 166 1176 30
7 755 114 195 131 418 54 902 53 292 136 178 42 495 153
7 1226 109 1111 44 1282 91 624 30 1220 79 357 151 232 140
8 894 81 1519 65 1442 84 1157 3 952 150 1252 158 1005 67 1104 21
4 505 33 608 37 40 75 782 158
2 1002 167 826 9
1 301 138
3 81 85 1156 29 1261 125
6 1266 88 1570 157 1179 126 605 128 1375 14 972 57
8 840 85 327 118 1527 22 964 139 1347 110 1607 68 794 92 1577 6
8 253 129 1256 25 50 67 77 112 1195 84 1473 73 105 153 1410 167
4 358 2 1310 51 950 80 814 58
6 57 142 439 5 329 155 144 155 868 114 410 72
2 862 92 379 116
7 102 88 372 22 1236 53 1608 75 425 47 1574 154 1607 7
4 1150 83 1047 112 725 46 498 166
3 363 35 1014 138 911 53
3 18

Please log in to submit a solution to this problem

Log in