結果

問題 No.1265 Balloon Survival
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-10-23 23:17:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,660 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 728 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 134,500 KB
最終ジャッジ日時 2023-09-28 18:30:33
合計ジャッジ時間 23,095 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,080 KB
testcase_01 AC 72 ms
71,160 KB
testcase_02 AC 72 ms
71,096 KB
testcase_03 AC 72 ms
71,236 KB
testcase_04 AC 74 ms
70,948 KB
testcase_05 AC 73 ms
70,948 KB
testcase_06 AC 72 ms
71,164 KB
testcase_07 AC 74 ms
71,156 KB
testcase_08 AC 72 ms
70,996 KB
testcase_09 AC 74 ms
71,080 KB
testcase_10 AC 74 ms
70,984 KB
testcase_11 AC 73 ms
71,072 KB
testcase_12 AC 74 ms
71,196 KB
testcase_13 AC 73 ms
71,232 KB
testcase_14 AC 211 ms
79,976 KB
testcase_15 AC 162 ms
78,488 KB
testcase_16 AC 107 ms
76,112 KB
testcase_17 AC 775 ms
102,744 KB
testcase_18 AC 126 ms
77,192 KB
testcase_19 AC 112 ms
76,088 KB
testcase_20 AC 200 ms
79,840 KB
testcase_21 AC 409 ms
95,348 KB
testcase_22 AC 266 ms
81,240 KB
testcase_23 AC 261 ms
82,448 KB
testcase_24 AC 1,651 ms
132,476 KB
testcase_25 AC 1,647 ms
133,488 KB
testcase_26 AC 1,660 ms
134,500 KB
testcase_27 AC 1,627 ms
133,420 KB
testcase_28 AC 1,583 ms
134,276 KB
testcase_29 AC 1,657 ms
134,168 KB
testcase_30 AC 1,611 ms
134,284 KB
testcase_31 AC 1,630 ms
133,468 KB
testcase_32 AC 1,644 ms
133,488 KB
testcase_33 AC 1,614 ms
133,528 KB
testcase_34 AC 74 ms
71,244 KB
testcase_35 AC 72 ms
71,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
n = int(input())
xy = [list(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