結果

問題 No.1265 Balloon Survival
ユーザー yakeshibayakeshiba
提出日時 2020-11-17 15:15:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,912 ms / 2,000 ms
コード長 620 bytes
コンパイル時間 1,045 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 144,640 KB
最終ジャッジ日時 2023-09-30 14:15:05
合計ジャッジ時間 25,122 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,644 KB
testcase_01 AC 75 ms
71,600 KB
testcase_02 AC 72 ms
71,384 KB
testcase_03 AC 72 ms
71,520 KB
testcase_04 AC 72 ms
71,532 KB
testcase_05 AC 72 ms
71,556 KB
testcase_06 AC 71 ms
71,704 KB
testcase_07 AC 71 ms
71,500 KB
testcase_08 AC 72 ms
71,236 KB
testcase_09 AC 71 ms
71,356 KB
testcase_10 AC 71 ms
71,512 KB
testcase_11 AC 72 ms
71,668 KB
testcase_12 AC 71 ms
71,376 KB
testcase_13 AC 71 ms
71,496 KB
testcase_14 AC 234 ms
87,256 KB
testcase_15 AC 173 ms
78,780 KB
testcase_16 AC 110 ms
76,556 KB
testcase_17 AC 896 ms
109,240 KB
testcase_18 AC 130 ms
77,272 KB
testcase_19 AC 114 ms
76,780 KB
testcase_20 AC 226 ms
86,924 KB
testcase_21 AC 418 ms
89,680 KB
testcase_22 AC 283 ms
88,104 KB
testcase_23 AC 303 ms
87,888 KB
testcase_24 AC 1,887 ms
144,548 KB
testcase_25 AC 1,865 ms
144,584 KB
testcase_26 AC 1,893 ms
144,340 KB
testcase_27 AC 1,897 ms
144,320 KB
testcase_28 AC 1,888 ms
144,564 KB
testcase_29 AC 1,879 ms
144,640 KB
testcase_30 AC 1,875 ms
144,500 KB
testcase_31 AC 1,885 ms
144,488 KB
testcase_32 AC 1,912 ms
144,624 KB
testcase_33 AC 1,880 ms
144,344 KB
testcase_34 AC 74 ms
71,548 KB
testcase_35 AC 73 ms
71,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n = int(input())

balloons = []
for _ in range(n):
    x, y = map(int,input().split())
    balloons.append((x, y))

dist = []
for a, b in itertools.combinations([i for i in range(n)], 2):
    x1, y1 = balloons[a]
    x2, y2 = balloons[b]
    d = (x2-x1)**2+(y2-y1)**2
    dist.append((d, a, b))
    
dist.sort()

removed = [0]*n
ans = 0
for d in dist:
    a = d[1]
    b = d[2]
    if a == 0:
        if removed[b] == 0:
            ans += 1
            removed[b] = 1
    else:
        if removed[a] == 0 and removed[b] == 0:
            removed[a] = 1
            removed[b] = 1

print(ans)

        
0