結果
| 問題 | No.1265 Balloon Survival |
| ユーザー |
|
| 提出日時 | 2021-01-07 22:22:34 |
| 言語 | Python3 (3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1,204 ms / 2,000 ms |
| + 735µs | |
| コード長 | 540 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 14,720 KB |
| 実行使用メモリ | 94,640 KB |
| 最終ジャッジ日時 | 2026-11-13 11:03:15 |
| 合計ジャッジ時間 | 17,674 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 35 |
ソースコード
from operator import itemgetter
n=int(input())
baloons=[tuple(map(int,input().split())) for i in range(n)]
d=[]
cnt=0
for i in range(n-1):
for j in range(i+1,n):
d.append([(baloons[i][0]-baloons[j][0])**2+(baloons[i][1]-baloons[j][1])**2,i,j])
d.sort(key=itemgetter(0))
used=[0 for i in range(n)]
for i in range(int(n*(n-1)/2)):
if(used[d[i][1]]==0 and used[d[i][2]]==0):
if(d[i][1]==0):
cnt+=1
used[d[i][2]]=1
else:
used[d[i][1]]=1
used[d[i][2]]=1
print(cnt)