結果

問題 No.1265 Balloon Survival
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-10-23 23:21:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,429 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 84,724 KB
最終ジャッジ日時 2023-09-28 18:35:07
合計ジャッジ時間 17,390 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,176 KB
testcase_01 AC 17 ms
8,300 KB
testcase_02 AC 17 ms
7,864 KB
testcase_03 AC 17 ms
8,232 KB
testcase_04 AC 17 ms
8,292 KB
testcase_05 AC 17 ms
8,324 KB
testcase_06 AC 17 ms
8,224 KB
testcase_07 AC 19 ms
8,108 KB
testcase_08 AC 17 ms
8,196 KB
testcase_09 AC 17 ms
8,184 KB
testcase_10 AC 17 ms
8,152 KB
testcase_11 AC 17 ms
8,208 KB
testcase_12 AC 17 ms
8,160 KB
testcase_13 AC 17 ms
8,168 KB
testcase_14 AC 142 ms
16,372 KB
testcase_15 AC 105 ms
14,184 KB
testcase_16 AC 43 ms
10,204 KB
testcase_17 AC 699 ms
47,856 KB
testcase_18 AC 61 ms
11,240 KB
testcase_19 AC 46 ms
10,572 KB
testcase_20 AC 130 ms
16,228 KB
testcase_21 AC 321 ms
26,800 KB
testcase_22 AC 177 ms
19,568 KB
testcase_23 AC 208 ms
20,588 KB
testcase_24 AC 1,429 ms
83,648 KB
testcase_25 AC 1,400 ms
84,480 KB
testcase_26 AC 1,391 ms
84,724 KB
testcase_27 AC 1,345 ms
84,492 KB
testcase_28 AC 1,309 ms
84,560 KB
testcase_29 AC 1,371 ms
84,636 KB
testcase_30 AC 1,351 ms
84,564 KB
testcase_31 AC 1,385 ms
84,500 KB
testcase_32 AC 1,276 ms
84,616 KB
testcase_33 AC 1,348 ms
84,536 KB
testcase_34 AC 17 ms
8,172 KB
testcase_35 AC 17 ms
8,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
n = int(input())
xy = [tuple(map(int,input().split())) for i in range(n)]

l = []
for i in range(n-1):
    for j in range(i+1,n):
        dis = (xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2
        l.append((dis,i,j))

ans = 0
count = [1]*n
l.sort()
su = n
for dis,i,j in l:
    if count[i] == 0 or count[j] == 0:
        continue
    if i != 0:
        count[i] -= 1
        count[j] -= 1
        su -= 2
    if i == 0:
        ans += 1
        count[j] -= 1
        su -= 1
    if su == 1:
        print(ans)
        exit()
print(ans)
0