結果

問題 No.1265 Balloon Survival
ユーザー rlangevinrlangevin
提出日時 2023-01-23 20:10:42
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 519 bytes
コンパイル時間 2,022 ms
コンパイル使用メモリ 85,256 KB
実行使用メモリ 154,724 KB
最終ジャッジ日時 2023-09-07 20:59:46
合計ジャッジ時間 28,540 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
70,920 KB
testcase_01 AC 84 ms
71,108 KB
testcase_02 AC 83 ms
71,148 KB
testcase_03 AC 83 ms
71,440 KB
testcase_04 AC 86 ms
70,916 KB
testcase_05 AC 82 ms
71,160 KB
testcase_06 AC 95 ms
71,196 KB
testcase_07 AC 85 ms
71,124 KB
testcase_08 AC 87 ms
71,212 KB
testcase_09 AC 86 ms
71,148 KB
testcase_10 AC 86 ms
71,064 KB
testcase_11 AC 87 ms
71,288 KB
testcase_12 AC 86 ms
71,068 KB
testcase_13 AC 83 ms
71,376 KB
testcase_14 AC 242 ms
80,072 KB
testcase_15 AC 201 ms
78,648 KB
testcase_16 AC 130 ms
76,196 KB
testcase_17 AC 895 ms
102,432 KB
testcase_18 AC 156 ms
77,372 KB
testcase_19 AC 137 ms
76,384 KB
testcase_20 AC 241 ms
80,200 KB
testcase_21 AC 494 ms
92,824 KB
testcase_22 AC 316 ms
90,532 KB
testcase_23 AC 346 ms
92,300 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 1,984 ms
154,508 KB
testcase_27 TLE -
testcase_28 AC 1,973 ms
154,716 KB
testcase_29 AC 1,994 ms
154,724 KB
testcase_30 TLE -
testcase_31 AC 1,967 ms
154,464 KB
testcase_32 AC 1,983 ms
154,128 KB
testcase_33 TLE -
testcase_34 AC 86 ms
71,140 KB
testcase_35 AC 83 ms
71,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(a, b):
    return (X[a] - X[b])**2 + (Y[a] - Y[b])**2

N = int(input())
X, Y = [0] * N, [0] * N
for i in range(N):
    X[i], Y[i] = map(int, input().split())
L = []
for i in range(N):
    for j in range(i + 1, N):
        L.append((f(i, j), i, j))
        
L.sort()
S = set()
ans = 0
for _, i, j in L:
    if i == 0:
        if j in S:
            continue
        else:
            ans += 1
            S.add(j)
    else:
        if i not in S and j not in S:
            S.add(i)
            S.add(j)
print(ans)
0