結果

問題 No.1265 Balloon Survival
ユーザー kotatsuinu5kotatsuinu5
提出日時 2020-10-23 23:10:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 913 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 34,012 KB
最終ジャッジ日時 2023-09-28 17:51:27
合計ジャッジ時間 8,671 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
29,600 KB
testcase_01 AC 136 ms
29,524 KB
testcase_02 AC 133 ms
29,768 KB
testcase_03 AC 136 ms
29,624 KB
testcase_04 AC 136 ms
29,592 KB
testcase_05 AC 136 ms
29,648 KB
testcase_06 AC 134 ms
29,616 KB
testcase_07 AC 133 ms
29,572 KB
testcase_08 AC 135 ms
29,500 KB
testcase_09 AC 134 ms
29,548 KB
testcase_10 AC 134 ms
29,724 KB
testcase_11 AC 134 ms
29,556 KB
testcase_12 AC 135 ms
29,632 KB
testcase_13 AC 135 ms
29,680 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 numpy as np

N=int(input())
S=np.full((N,2),0)

for i in range(N):
    A,B=map(int,input().split())
    S[i][0]=A
    S[i][1]=B
    
    
count=0

while N!=1:
    tmp=10**18
    for i in range(N):
        tmpx1=S[i][0]
        tmpy1=S[i][1]
        for j in range(N):
            if i!=j:
                tmpx2=S[j][0]
                tmpy2=S[j][1]
                
                if (tmpx2-tmpx1)**2+(tmpy2-tmpy1)**2<tmp:
                    tmp=(tmpx2-tmpx1)**2+(tmpy2-tmpy1)**2
                    tmp1=i
                    tmp2=j
    #print("tmp",tmp,tmp1,tmp2)
    if tmp1==0:
        N-=1
        S=np.delete(S,tmp2,0)
        count+=1
    elif tmp2==0:
        N-=1
        S=np.delete(S,tmp1,0)
        count+=1
    else:
        N-=2
        #print("mohu2")
        S=np.delete(S,max(tmp1,tmp2),0)
        S=np.delete(S,min(tmp1,tmp2),0)
    #print(S)
    #print("mohu")
print(count)            
0