結果

問題 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,465 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 109,768 KB
最終ジャッジ日時 2024-04-26 15:03:38
合計ジャッジ時間 18,735 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,880 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 29 ms
10,624 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 29 ms
10,752 KB
testcase_07 AC 29 ms
10,624 KB
testcase_08 AC 30 ms
10,880 KB
testcase_09 AC 28 ms
10,752 KB
testcase_10 AC 29 ms
10,752 KB
testcase_11 AC 28 ms
10,624 KB
testcase_12 AC 29 ms
10,752 KB
testcase_13 AC 30 ms
10,752 KB
testcase_14 AC 138 ms
21,676 KB
testcase_15 AC 106 ms
18,688 KB
testcase_16 AC 57 ms
13,568 KB
testcase_17 AC 680 ms
62,472 KB
testcase_18 AC 71 ms
14,976 KB
testcase_19 AC 59 ms
13,824 KB
testcase_20 AC 133 ms
21,552 KB
testcase_21 AC 314 ms
35,180 KB
testcase_22 AC 188 ms
25,596 KB
testcase_23 AC 211 ms
27,180 KB
testcase_24 AC 1,427 ms
107,948 KB
testcase_25 AC 1,445 ms
109,600 KB
testcase_26 AC 1,449 ms
109,768 KB
testcase_27 AC 1,431 ms
109,768 KB
testcase_28 AC 1,434 ms
109,548 KB
testcase_29 AC 1,446 ms
109,736 KB
testcase_30 AC 1,464 ms
109,652 KB
testcase_31 AC 1,446 ms
109,604 KB
testcase_32 AC 1,465 ms
109,620 KB
testcase_33 AC 1,427 ms
109,668 KB
testcase_34 AC 30 ms
10,880 KB
testcase_35 AC 30 ms
10,752 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