結果

問題 No.1265 Balloon Survival
ユーザー tanon710tanon710
提出日時 2020-10-24 00:02:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,366 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 1,802 ms
コンパイル使用メモリ 86,756 KB
実行使用メモリ 154,640 KB
最終ジャッジ日時 2023-09-28 19:23:31
合計ジャッジ時間 18,592 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,392 KB
testcase_01 AC 74 ms
71,028 KB
testcase_02 AC 75 ms
71,236 KB
testcase_03 AC 75 ms
71,384 KB
testcase_04 AC 74 ms
71,156 KB
testcase_05 AC 73 ms
71,364 KB
testcase_06 AC 73 ms
71,344 KB
testcase_07 AC 78 ms
71,208 KB
testcase_08 AC 75 ms
71,228 KB
testcase_09 AC 75 ms
71,340 KB
testcase_10 AC 73 ms
71,336 KB
testcase_11 AC 74 ms
71,232 KB
testcase_12 AC 74 ms
71,156 KB
testcase_13 AC 76 ms
71,388 KB
testcase_14 AC 197 ms
87,732 KB
testcase_15 AC 140 ms
79,456 KB
testcase_16 AC 102 ms
76,592 KB
testcase_17 AC 639 ms
124,304 KB
testcase_18 AC 116 ms
77,776 KB
testcase_19 AC 103 ms
76,760 KB
testcase_20 AC 161 ms
80,924 KB
testcase_21 AC 296 ms
93,276 KB
testcase_22 AC 222 ms
92,128 KB
testcase_23 AC 234 ms
93,104 KB
testcase_24 AC 1,279 ms
154,180 KB
testcase_25 AC 1,268 ms
154,408 KB
testcase_26 AC 1,288 ms
154,336 KB
testcase_27 AC 1,279 ms
154,284 KB
testcase_28 AC 1,275 ms
154,640 KB
testcase_29 AC 1,315 ms
154,336 KB
testcase_30 AC 1,366 ms
154,288 KB
testcase_31 AC 1,291 ms
154,440 KB
testcase_32 AC 1,330 ms
154,316 KB
testcase_33 AC 1,291 ms
154,464 KB
testcase_34 AC 77 ms
71,420 KB
testcase_35 AC 75 ms
71,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
pos=[list(map(int,input().split())) for _ in range(n)]
dist=[]
for i in range(n):
    x1,y1=pos[i]
    for j in range(i+1,n):
        x2,y2=pos[j]
        d=(x1-x2)**2+(y1-y2)**2
        dist.append((d,i,j))
dist=sorted(dist,key=lambda x:x[0])
used=set()
ans=0
for _,i,j in dist:
    if i==0:
        if j in used:
            continue
        else:
            ans+=1
            used.add(j)
    else:
        if i in used or j in used:
            continue
        else:
            used.add(i)
            used.add(j)
print(ans)
0