結果

問題 No.1265 Balloon Survival
ユーザー ntudantuda
提出日時 2022-03-12 09:49:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,783 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 86,612 KB
実行使用メモリ 155,044 KB
最終ジャッジ日時 2023-10-14 21:37:47
合計ジャッジ時間 24,342 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,100 KB
testcase_01 AC 76 ms
71,068 KB
testcase_02 AC 76 ms
71,064 KB
testcase_03 AC 76 ms
71,188 KB
testcase_04 AC 75 ms
71,128 KB
testcase_05 AC 76 ms
71,240 KB
testcase_06 AC 76 ms
71,144 KB
testcase_07 AC 77 ms
71,128 KB
testcase_08 AC 78 ms
71,072 KB
testcase_09 AC 76 ms
70,936 KB
testcase_10 AC 76 ms
71,116 KB
testcase_11 AC 76 ms
71,200 KB
testcase_12 AC 77 ms
71,216 KB
testcase_13 AC 75 ms
71,192 KB
testcase_14 AC 212 ms
80,024 KB
testcase_15 AC 177 ms
78,424 KB
testcase_16 AC 112 ms
76,316 KB
testcase_17 AC 800 ms
101,932 KB
testcase_18 AC 130 ms
77,488 KB
testcase_19 AC 116 ms
76,408 KB
testcase_20 AC 207 ms
79,984 KB
testcase_21 AC 426 ms
92,864 KB
testcase_22 AC 282 ms
91,064 KB
testcase_23 AC 302 ms
92,228 KB
testcase_24 AC 1,773 ms
153,708 KB
testcase_25 AC 1,736 ms
154,376 KB
testcase_26 AC 1,774 ms
154,916 KB
testcase_27 AC 1,763 ms
154,568 KB
testcase_28 AC 1,762 ms
151,788 KB
testcase_29 AC 1,783 ms
155,044 KB
testcase_30 AC 1,750 ms
154,912 KB
testcase_31 AC 1,742 ms
154,360 KB
testcase_32 AC 1,780 ms
154,344 KB
testcase_33 AC 1,765 ms
154,488 KB
testcase_34 AC 78 ms
71,112 KB
testcase_35 AC 76 ms
71,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
D = []

for i in range(N - 1):
    x1, y1 = XY[i]
    for j in range(i + 1, N):
        x2, y2 = XY[j]
        d2 = (x1 - x2) ** 2 + (y1 - y2) ** 2
        D.append((d2, i, j))
D.sort()
cnt = 0
removed = set()
for d, i, j in D:
    if i == 0:
        if j in removed:
            continue
        else:
            removed.add(j)
            cnt += 1
    else:
        if i in removed or j in removed:
            continue
        else:
            removed.add(i)
            removed.add(j)
print(cnt)
0