結果

問題 No.1265 Balloon Survival
ユーザー uni_pythonuni_python
提出日時 2020-11-01 22:47:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 739 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 8,636 KB
最終ジャッジ日時 2023-09-29 11:27:53
合計ジャッジ時間 4,331 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,828 KB
testcase_01 AC 16 ms
8,316 KB
testcase_02 AC 16 ms
8,368 KB
testcase_03 AC 15 ms
7,840 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,808 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 15 ms
7,952 KB
testcase_09 AC 16 ms
7,908 KB
testcase_10 AC 16 ms
7,792 KB
testcase_11 AC 16 ms
7,844 KB
testcase_12 WA -
testcase_13 AC 16 ms
7,848 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

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