結果

問題 No.1265 Balloon Survival
ユーザー uni_pythonuni_python
提出日時 2020-11-01 22:46:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 745 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 136,036 KB
最終ジャッジ日時 2023-09-29 11:27:48
合計ジャッジ時間 6,023 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,904 KB
testcase_01 AC 70 ms
71,476 KB
testcase_02 AC 69 ms
71,564 KB
testcase_03 AC 70 ms
71,796 KB
testcase_04 WA -
testcase_05 AC 70 ms
71,476 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 71 ms
71,488 KB
testcase_09 AC 68 ms
71,932 KB
testcase_10 AC 69 ms
71,872 KB
testcase_11 AC 69 ms
71,644 KB
testcase_12 WA -
testcase_13 AC 69 ms
71,488 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 70 ms
71,588 KB
testcase_35 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0