QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 2048 MB 満点: 100

#14441. 冰壺

統計

冰壺(Curling)是一項冬季運動。兩支隊伍的選手輪流將各自顏色(紅色或黃色)的八顆「冰壺」滑向冰道,試圖讓冰壺盡可能靠近「圓心」(button)。冰道長 138 英尺,寬 14 英尺。以英吋計算,即 $1,656 \times 168$。圓心距離冰道末端 12 英尺,位於中心,距離兩側各 7 英尺。其位置為 $(144, 84)$(單位為英吋)。

每場比賽共有十局(frames)。在每一局中,兩隊輪流將冰壺滑向冰道,試圖讓自己的冰壺最靠近圓心(或將對手的冰壺撞離圓心)。哪一隊的冰壺最靠近圓心,該隊即可獲得該局的所有分數。他們每擁有一顆比對手所有冰壺都更靠近圓心的冰壺,即可獲得一分。冰壺有可能完全滑出冰道。

給定十局比賽中每一局結束後冰壺的位置(單位為英吋),並假設圓心位於 $(144, 84)$,請計算比賽的最終得分。

輸入格式

輸入包含恰好 20 行,分為 10 組。每一組包含該局紅色冰壺的位置,隨後是該局黃色冰壺的位置。

每一行以一個整數 $n$ ($0 \le n \le 8$) 開頭,代表留在冰道上的冰壺數量,隨後是 $n$ 個整數序對 $x$ ($0 \le x \le 1,656$) 和 $y$ ($0 \le y \le 168$),代表留在冰道上的每一顆冰壺的位置(單位為英吋)。保證在同一局中,不會有兩顆冰壺距離圓心的距離相等。

輸出格式

輸出兩個整數於同一行,分別為紅隊的總得分與黃隊的總得分。

範例

範例輸入 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

範例輸出 1

3 18

Figure 1. Curling rink layout

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.