結果

問題 No.1265 Balloon Survival
ユーザー lloyzlloyz
提出日時 2022-05-26 00:30:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 151,632 KB
最終ジャッジ日時 2023-10-20 19:17:35
合計ジャッジ時間 21,483 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,592 KB
testcase_01 AC 37 ms
53,592 KB
testcase_02 AC 38 ms
53,528 KB
testcase_03 AC 37 ms
53,592 KB
testcase_04 AC 37 ms
53,592 KB
testcase_05 AC 38 ms
53,596 KB
testcase_06 AC 38 ms
53,596 KB
testcase_07 AC 38 ms
53,596 KB
testcase_08 AC 38 ms
53,596 KB
testcase_09 AC 37 ms
53,596 KB
testcase_10 AC 37 ms
53,596 KB
testcase_11 AC 38 ms
53,596 KB
testcase_12 AC 38 ms
53,596 KB
testcase_13 AC 37 ms
53,596 KB
testcase_14 AC 179 ms
76,396 KB
testcase_15 AC 139 ms
70,868 KB
testcase_16 AC 75 ms
64,552 KB
testcase_17 AC 795 ms
101,424 KB
testcase_18 AC 96 ms
67,456 KB
testcase_19 AC 80 ms
64,704 KB
testcase_20 AC 174 ms
74,340 KB
testcase_21 AC 410 ms
94,604 KB
testcase_22 AC 225 ms
77,972 KB
testcase_23 AC 244 ms
79,504 KB
testcase_24 AC 1,757 ms
149,788 KB
testcase_25 AC 1,771 ms
150,844 KB
testcase_26 AC 1,695 ms
131,748 KB
testcase_27 AC 1,661 ms
130,784 KB
testcase_28 AC 1,667 ms
131,724 KB
testcase_29 AC 1,762 ms
151,632 KB
testcase_30 AC 1,685 ms
131,732 KB
testcase_31 AC 1,668 ms
130,924 KB
testcase_32 AC 1,749 ms
150,840 KB
testcase_33 AC 1,660 ms
130,784 KB
testcase_34 AC 39 ms
53,596 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

n = int(input())
P = [list(map(int, input().split())) for _ in range(n)]

L = []
for i in range(n):
    for j in range(i + 1, n):
        L.append((sqrt((P[i][0] - P[j][0])**2 + (P[i][1] - P[j][1])**2), i, j))

L.sort()
seen = set()
ans = 0
for _, i, j in L:
    if i == 0:
        if j in seen:
            continue
        ans += 1
        seen.add(j)
    else:
        if i in seen or j in seen:
            continue
        seen.add(i)
        seen.add(j)
print(ans)
0