結果

問題 No.1265 Balloon Survival
ユーザー c-yanc-yan
提出日時 2020-10-23 22:30:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 525 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 10,788 KB
実行使用メモリ 86,080 KB
最終ジャッジ日時 2023-09-28 16:38:12
合計ジャッジ時間 23,107 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,004 KB
testcase_01 AC 17 ms
8,092 KB
testcase_02 AC 17 ms
8,008 KB
testcase_03 AC 17 ms
7,972 KB
testcase_04 AC 17 ms
8,008 KB
testcase_05 AC 17 ms
8,028 KB
testcase_06 AC 17 ms
7,972 KB
testcase_07 AC 17 ms
8,052 KB
testcase_08 AC 17 ms
8,056 KB
testcase_09 AC 17 ms
7,956 KB
testcase_10 AC 16 ms
7,996 KB
testcase_11 AC 16 ms
8,064 KB
testcase_12 AC 17 ms
8,008 KB
testcase_13 AC 17 ms
8,004 KB
testcase_14 AC 186 ms
16,136 KB
testcase_15 AC 130 ms
13,860 KB
testcase_16 AC 53 ms
10,240 KB
testcase_17 AC 1,201 ms
46,556 KB
testcase_18 AC 74 ms
11,252 KB
testcase_19 AC 58 ms
10,536 KB
testcase_20 AC 186 ms
15,848 KB
testcase_21 AC 481 ms
26,508 KB
testcase_22 AC 260 ms
19,004 KB
testcase_23 AC 285 ms
20,136 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 AC 18 ms
8,044 KB
testcase_35 AC 17 ms
8,080 KB
権限があれば一括ダウンロードができます

ソースコード

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