結果

問題 No.1265 Balloon Survival
ユーザー yakeshibayakeshiba
提出日時 2020-11-17 15:18:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,746 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 150,740 KB
最終ジャッジ日時 2023-09-30 14:15:32
合計ジャッジ時間 22,462 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,460 KB
testcase_01 AC 70 ms
71,464 KB
testcase_02 AC 72 ms
71,216 KB
testcase_03 AC 72 ms
71,328 KB
testcase_04 AC 75 ms
71,544 KB
testcase_05 AC 72 ms
71,204 KB
testcase_06 AC 72 ms
71,300 KB
testcase_07 AC 73 ms
71,400 KB
testcase_08 AC 74 ms
71,160 KB
testcase_09 AC 72 ms
71,332 KB
testcase_10 AC 70 ms
71,328 KB
testcase_11 AC 71 ms
71,372 KB
testcase_12 AC 72 ms
71,288 KB
testcase_13 AC 72 ms
71,332 KB
testcase_14 AC 202 ms
79,544 KB
testcase_15 AC 166 ms
78,468 KB
testcase_16 AC 102 ms
75,828 KB
testcase_17 AC 838 ms
111,216 KB
testcase_18 AC 121 ms
76,656 KB
testcase_19 AC 109 ms
75,860 KB
testcase_20 AC 195 ms
79,460 KB
testcase_21 AC 398 ms
89,892 KB
testcase_22 AC 261 ms
89,476 KB
testcase_23 AC 285 ms
89,124 KB
testcase_24 AC 1,718 ms
149,124 KB
testcase_25 AC 1,656 ms
150,048 KB
testcase_26 AC 1,664 ms
150,740 KB
testcase_27 AC 1,691 ms
150,044 KB
testcase_28 AC 1,679 ms
150,616 KB
testcase_29 AC 1,736 ms
150,380 KB
testcase_30 AC 1,695 ms
150,716 KB
testcase_31 AC 1,746 ms
150,100 KB
testcase_32 AC 1,687 ms
149,920 KB
testcase_33 AC 1,635 ms
150,052 KB
testcase_34 AC 71 ms
71,576 KB
testcase_35 AC 69 ms
71,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import itertools

input=sys.stdin.readline


def main(args):
    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)
    
if __name__ == '__main__':
    main(sys.argv[1:])
0