結果

問題 No.1265 Balloon Survival
ユーザー kotatsuinu5kotatsuinu5
提出日時 2020-10-24 00:01:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 801 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 81,092 KB
最終ジャッジ日時 2023-09-28 19:23:06
合計ジャッジ時間 15,291 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
30,052 KB
testcase_01 AC 139 ms
29,764 KB
testcase_02 AC 142 ms
29,504 KB
testcase_03 AC 139 ms
29,656 KB
testcase_04 AC 138 ms
29,664 KB
testcase_05 AC 139 ms
29,772 KB
testcase_06 AC 139 ms
29,788 KB
testcase_07 AC 139 ms
29,768 KB
testcase_08 AC 140 ms
29,860 KB
testcase_09 AC 139 ms
29,740 KB
testcase_10 AC 137 ms
29,768 KB
testcase_11 WA -
testcase_12 AC 139 ms
29,700 KB
testcase_13 WA -
testcase_14 AC 430 ms
35,200 KB
testcase_15 AC 325 ms
33,676 KB
testcase_16 AC 187 ms
30,948 KB
testcase_17 TLE -
testcase_18 AC 220 ms
31,860 KB
testcase_19 AC 193 ms
31,336 KB
testcase_20 AC 417 ms
34,864 KB
testcase_21 AC 1,029 ms
41,696 KB
testcase_22 AC 573 ms
36,944 KB
testcase_23 AC 636 ms
37,736 KB
testcase_24 TLE -
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:
    
    all_diffs = np.expand_dims(S, axis=1) - np.expand_dims(S, axis=0)
    degree_distance = np.sqrt(np.sum(all_diffs ** 2, axis=-1))
    
   
    
    tmp=np.where(degree_distance==degree_distance[degree_distance>0].min())
    tmp1=tmp[0][0]
    tmp2=tmp[0][1]
    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("mohu")
    
print(count)            
0