結果
問題 | No.1265 Balloon Survival |
ユーザー |
![]() |
提出日時 | 2020-12-18 15:20:17 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,838 ms / 2,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 435 ms |
コンパイル使用メモリ | 82,032 KB |
実行使用メモリ | 157,612 KB |
最終ジャッジ日時 | 2024-09-21 09:10:53 |
合計ジャッジ時間 | 22,740 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
import sysinput=sys.stdin.readlineN=int(input())A=[]for i in range(N):x,y=map(int, input().split())A.append((x,y,i))B=[]for i in range(N-1):for j in range(i+1,N):ax,ay,an=A[i][0],A[i][1],A[i][2]bx,by,bn=A[j][0],A[j][1],A[j][2]d=(ax-bx)**2+(ay-by)**2B.append((d,an,bn))B=sorted(B)ans=0D=[1]*Nfrom collections import dequed=deque(B)while d:a,an,bn=d.popleft()if D[an]==1 and D[bn]==1:if an==0:ans+=1D[bn]=0else:D[an]=0D[bn]=0print(ans)