結果
問題 | No.1265 Balloon Survival |
ユーザー |
![]() |
提出日時 | 2020-12-18 15:20:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,763 ms / 2,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 76,548 KB |
最終ジャッジ日時 | 2024-09-21 09:11:16 |
合計ジャッジ時間 | 21,107 ms |
ジャッジサーバーID (参考情報) |
judge3 / 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)