QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 2048 MB 總分: 100

#14441. カーリング

统计

カーリングは冬季スポーツです。2つのチームがそれぞれ赤または黄色の「ストーン」を8個ずつ持ち、氷上のシートの上で交互に滑らせて、できるだけ「ボタン」の近くに止まるように競います。氷上のシートは長さ138フィート、幅14フィートです。インチ単位では $1,656 \times 168$ となります。ボタンは端から12フィート、中央(両端から7フィート)の位置にあります。これはインチ単位で $(144, 84)$ の位置です。

各ゲームは10フレームで行われます。各フレームでは、チームが交互にストーンを滑らせ、自分のストーンをボタンに最も近づけようとします(あるいは相手のストーンをボタンから弾き飛ばそうとします)。ボタンに最も近いストーンを持つチームが、そのフレームのすべての得点を獲得します。得点は、相手チームのどのストーンよりもボタンに近い、自分たちのストーンの数だけ与えられます。ストーンが氷上のシートから完全に出てしまうこともあります。

10フレーム終了後の各ストーンの位置(インチ単位)が与えられたとき、ボタンの位置を $(144, 84)$ と仮定して、ゲームの最終スコアを計算してください。

入力

入力は正確に20行で構成され、10個のペアになっています。各ペアは、1フレームにおける赤のストーンの位置と、それに続く黄色のストーンの位置で構成されます。

各行は、氷上のシートに残っているストーンの数を示す整数 $n$ ($0 \le n \le 8$) で始まり、その後にシートに残っている各ストーンの位置を示す $n$ 個の整数の順序対 $x$ ($0 \le x \le 1,656$) および $y$ ($0 \le y \le 168$) が続きます。1つのフレーム内で、2つのストーンがボタンから同じ距離にあることはないことが保証されています。

出力

赤チームのスコアと黄色チームのスコアを、1行にスペース区切りで出力してください。

入出力例

入力 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

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.