結果

問題 No.1265 Balloon Survival
ユーザー tanon710
提出日時 2020-10-24 00:00:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 553 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 82,692 KB
実行使用メモリ 153,684 KB
最終ジャッジ日時 2024-07-21 14:00:50
合計ジャッジ時間 16,507 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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)**0.5
        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