結果

問題 No.1265 Balloon Survival
ユーザー brthyyjpbrthyyjp
提出日時 2020-10-23 22:50:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 591 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 152,008 KB
最終ジャッジ日時 2023-09-28 17:18:50
合計ジャッジ時間 27,921 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,516 KB
testcase_01 AC 79 ms
71,624 KB
testcase_02 AC 80 ms
71,284 KB
testcase_03 AC 79 ms
71,460 KB
testcase_04 AC 80 ms
71,324 KB
testcase_05 AC 81 ms
71,476 KB
testcase_06 AC 77 ms
71,176 KB
testcase_07 AC 80 ms
71,088 KB
testcase_08 AC 80 ms
71,516 KB
testcase_09 AC 80 ms
71,456 KB
testcase_10 AC 81 ms
71,476 KB
testcase_11 AC 80 ms
71,340 KB
testcase_12 AC 83 ms
71,268 KB
testcase_13 AC 82 ms
71,320 KB
testcase_14 AC 258 ms
84,260 KB
testcase_15 AC 209 ms
84,080 KB
testcase_16 AC 122 ms
76,592 KB
testcase_17 AC 1,026 ms
109,276 KB
testcase_18 AC 145 ms
77,680 KB
testcase_19 AC 127 ms
76,808 KB
testcase_20 AC 252 ms
84,084 KB
testcase_21 AC 488 ms
98,028 KB
testcase_22 AC 309 ms
85,720 KB
testcase_23 AC 333 ms
86,480 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 78 ms
71,328 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
XY = []
for i in range(n):
    x, y = map(int, input().split())
    XY.append((x, y))

if n == 1:
    print(0)
    exit()

import math
INF = float('inf')
T = []
for i in range(n-1):
    x1, y1=XY[i]
    for j in range(i+1, n):
        x2,y2 = XY[j]
        d = math.hypot(x1-x2, y1-y2)/2
        T.append((d, i, j))

T.sort()
#print(T)
used = set()
ans = 0
for d, i, j in T:
    if i == 0:
        if j not in used:
            ans += 1
            used.add(j)
    else:
        if i not in used and j not in used:
            used.add(i)
            used.add(j)
print(ans)
0