結果

問題 No.1265 Balloon Survival
ユーザー c-yanc-yan
提出日時 2020-10-23 22:29:37
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 525 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 86,656 KB
実行使用メモリ 155,404 KB
最終ジャッジ日時 2023-09-28 16:35:21
合計ジャッジ時間 10,826 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
78,240 KB
testcase_01 AC 85 ms
71,472 KB
testcase_02 AC 86 ms
71,416 KB
testcase_03 AC 84 ms
71,564 KB
testcase_04 AC 85 ms
71,488 KB
testcase_05 AC 89 ms
75,560 KB
testcase_06 AC 85 ms
71,404 KB
testcase_07 AC 84 ms
71,384 KB
testcase_08 AC 83 ms
71,564 KB
testcase_09 AC 85 ms
71,476 KB
testcase_10 AC 85 ms
71,388 KB
testcase_11 AC 87 ms
71,400 KB
testcase_12 AC 89 ms
75,552 KB
testcase_13 AC 85 ms
71,136 KB
testcase_14 AC 391 ms
87,436 KB
testcase_15 AC 299 ms
84,736 KB
testcase_16 AC 186 ms
80,032 KB
testcase_17 AC 1,623 ms
120,204 KB
testcase_18 AC 208 ms
81,520 KB
testcase_19 AC 185 ms
80,320 KB
testcase_20 AC 360 ms
87,168 KB
testcase_21 AC 732 ms
95,960 KB
testcase_22 AC 472 ms
88,828 KB
testcase_23 AC 493 ms
90,000 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop

N = int(input())
xy = [tuple(map(int, input().split())) for _ in range(N)]

a = []
for i in range(N - 1):
    for j in range(i + 1, N):
        d = (xy[i][0] - xy[j][0]) * (xy[i][0] - xy[j][0]) + (xy[i][1] - xy[j][1]) * (xy[i][1] - xy[j][1])
        a.append((d, i, j))
heapify(a)

result = 0
t = set()
while a:
    _, i, j = heappop(a)
    if i in t or j in t:
        continue
    if i == 0:
        result += 1
        t.add(j)
    else:
        t.add(i)
        t.add(j)
print(result)
0