結果

問題 No.1265 Balloon Survival
ユーザー jensenjensen
提出日時 2021-01-07 22:22:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,275 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 107,196 KB
最終ジャッジ日時 2023-08-08 22:52:49
合計ジャッジ時間 16,903 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,004 KB
testcase_01 AC 15 ms
7,960 KB
testcase_02 AC 15 ms
8,220 KB
testcase_03 AC 15 ms
8,084 KB
testcase_04 AC 14 ms
7,992 KB
testcase_05 AC 14 ms
8,176 KB
testcase_06 AC 14 ms
8,044 KB
testcase_07 AC 13 ms
8,032 KB
testcase_08 AC 14 ms
8,096 KB
testcase_09 AC 16 ms
7,992 KB
testcase_10 AC 13 ms
8,000 KB
testcase_11 AC 13 ms
8,036 KB
testcase_12 AC 14 ms
8,144 KB
testcase_13 AC 14 ms
7,992 KB
testcase_14 AC 96 ms
18,932 KB
testcase_15 AC 71 ms
16,136 KB
testcase_16 AC 34 ms
11,164 KB
testcase_17 AC 535 ms
59,932 KB
testcase_18 AC 44 ms
12,556 KB
testcase_19 AC 35 ms
11,504 KB
testcase_20 AC 97 ms
18,964 KB
testcase_21 AC 241 ms
32,540 KB
testcase_22 AC 138 ms
23,156 KB
testcase_23 AC 145 ms
24,700 KB
testcase_24 AC 1,188 ms
105,424 KB
testcase_25 AC 1,146 ms
107,124 KB
testcase_26 AC 1,163 ms
107,092 KB
testcase_27 AC 1,180 ms
106,908 KB
testcase_28 AC 1,178 ms
107,028 KB
testcase_29 AC 1,275 ms
107,196 KB
testcase_30 AC 1,271 ms
107,100 KB
testcase_31 AC 1,166 ms
107,032 KB
testcase_32 AC 1,190 ms
106,912 KB
testcase_33 AC 1,188 ms
106,904 KB
testcase_34 AC 15 ms
8,004 KB
testcase_35 AC 15 ms
8,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter
n=int(input())
baloons=[tuple(map(int,input().split())) for i in range(n)]
d=[]
cnt=0
for i in range(n-1):
    for j in range(i+1,n):
        d.append([(baloons[i][0]-baloons[j][0])**2+(baloons[i][1]-baloons[j][1])**2,i,j])
d.sort(key=itemgetter(0))
used=[0 for i in range(n)]
for i in range(int(n*(n-1)/2)):
    if(used[d[i][1]]==0 and used[d[i][2]]==0):
        if(d[i][1]==0):
            cnt+=1
            used[d[i][2]]=1
        else:
            used[d[i][1]]=1
            used[d[i][2]]=1
print(cnt) 
0