結果
| 問題 |
No.1265 Balloon Survival
|
| コンテスト | |
| ユーザー |
tyawanmusi
|
| 提出日時 | 2020-10-23 22:52:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,712 ms / 2,000 ms |
| コード長 | 458 bytes |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 82,044 KB |
| 実行使用メモリ | 139,236 KB |
| 最終ジャッジ日時 | 2024-07-21 12:03:06 |
| 合計ジャッジ時間 | 20,644 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
import sys
input = lambda:sys.stdin.readline().rstrip()
n=int(input())
xy=[tuple(map(int,input().split()))for _ in range(n)]
e=[]
for i in range(n-1):
for j in range(i+1,n):
x1,y1=xy[i]
x2,y2=xy[j]
e.append(((x1-x2)**2+(y1-y2)**2)*1000000+i*1000+j)
e.sort()
used=[0]*n
ans=0
for x in e:
_,x=divmod(x,1000000)
i,j=divmod(x,1000)
if used[i]+used[j]:
continue
if i==0:
used[j]=1
ans+=1
else:
used[i]=used[j]=1
print(ans)
tyawanmusi