結果

問題 No.1265 Balloon Survival
ユーザー sotanishysotanishy
提出日時 2020-10-23 22:26:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,228 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 152,496 KB
最終ジャッジ日時 2023-09-28 16:26:37
合計ジャッジ時間 17,179 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,212 KB
testcase_01 AC 75 ms
70,960 KB
testcase_02 AC 78 ms
71,260 KB
testcase_03 AC 79 ms
71,172 KB
testcase_04 AC 76 ms
71,244 KB
testcase_05 AC 78 ms
71,168 KB
testcase_06 AC 75 ms
71,180 KB
testcase_07 AC 76 ms
71,064 KB
testcase_08 AC 77 ms
71,216 KB
testcase_09 AC 78 ms
71,348 KB
testcase_10 AC 78 ms
71,068 KB
testcase_11 AC 76 ms
71,152 KB
testcase_12 AC 77 ms
71,212 KB
testcase_13 AC 79 ms
71,068 KB
testcase_14 AC 163 ms
80,192 KB
testcase_15 AC 140 ms
78,812 KB
testcase_16 AC 104 ms
76,444 KB
testcase_17 AC 620 ms
123,560 KB
testcase_18 AC 112 ms
77,336 KB
testcase_19 AC 104 ms
76,588 KB
testcase_20 AC 163 ms
80,212 KB
testcase_21 AC 292 ms
93,852 KB
testcase_22 AC 214 ms
92,220 KB
testcase_23 AC 221 ms
92,992 KB
testcase_24 AC 1,187 ms
152,476 KB
testcase_25 AC 1,204 ms
152,476 KB
testcase_26 AC 1,209 ms
152,388 KB
testcase_27 AC 1,194 ms
152,392 KB
testcase_28 AC 1,196 ms
152,448 KB
testcase_29 AC 1,220 ms
152,480 KB
testcase_30 AC 1,205 ms
152,496 KB
testcase_31 AC 1,214 ms
152,192 KB
testcase_32 AC 1,228 ms
152,476 KB
testcase_33 AC 1,186 ms
152,412 KB
testcase_34 AC 78 ms
71,296 KB
testcase_35 AC 76 ms
71,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline


def dist(a, b):
    return (a[0] - b[0])**2 + (a[1] - b[1])**2

N = int(input())
pts = [tuple(map(int, input().split())) for _ in range(N)]
edges = []
for i in range(N - 1):
    for j in range(i + 1, N):
        edges.append((dist(pts[i], pts[j]), i, j))
edges.sort(key=lambda x: x[0])
removed = [False] * N
ans = 0
for _, i, j in edges:
    if removed[i] or removed[j]:
        continue
    if i == 0:
        removed[j] = True
        ans += 1
    else:
        removed[i] = removed[j] = True
print(ans)
0