結果
| 問題 | No.1265 Balloon Survival |
| コンテスト | |
| ユーザー |
uni_python
|
| 提出日時 | 2020-11-01 22:46:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 745 bytes |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 82,120 KB |
| 実行使用メモリ | 130,352 KB |
| 最終ジャッジ日時 | 2024-07-22 05:55:32 |
| 合計ジャッジ時間 | 3,044 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 4 RE * 21 |
ソースコード
import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
N=I()
if N==1:
print(0)
exit()
if N==2:
print(1)
exit()
X=[0]*N
Y=[0]*N
for i in range(N):
X[i],Y[i]=MI()
# 取り除いた or 消えた
used=[0]*N
L=[]
for i in range(N):
for j in range(i+1,N):
d=(pow((X[i]-X[j]),2) + pow(2,(Y[i]-Y[j]))) **0.5
L.append((d,i,j))
ans=0
L.sort()
S=0
for temp in L:
d,i,j=temp
if i==0:
if used[j]==0:
ans+=1
used[j]=1
S+=1
if used[i]==0 and used[j]==0:
used[i]=1
used[j]=1
S+=2
if S==N-1:
break
print(ans)
uni_python