結果

問題 No.1265 Balloon Survival
ユーザー kotatsuinu5
提出日時 2020-10-24 00:01:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 801 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 75,176 KB
最終ジャッジ日時 2024-07-21 14:02:58
合計ジャッジ時間 14,081 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 2 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

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