結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,144 KB
testcase_01 AC 69 ms
71,400 KB
testcase_02 AC 72 ms
71,580 KB
testcase_03 AC 71 ms
71,408 KB
testcase_04 AC 71 ms
71,364 KB
testcase_05 AC 70 ms
71,144 KB
testcase_06 AC 71 ms
71,408 KB
testcase_07 AC 70 ms
71,452 KB
testcase_08 AC 71 ms
71,548 KB
testcase_09 AC 71 ms
71,444 KB
testcase_10 AC 69 ms
71,316 KB
testcase_11 AC 71 ms
71,456 KB
testcase_12 AC 70 ms
71,296 KB
testcase_13 AC 71 ms
71,112 KB
testcase_14 AC 194 ms
80,188 KB
testcase_15 AC 159 ms
78,824 KB
testcase_16 AC 102 ms
76,024 KB
testcase_17 AC 733 ms
102,300 KB
testcase_18 AC 122 ms
77,172 KB
testcase_19 AC 106 ms
76,296 KB
testcase_20 AC 190 ms
80,164 KB
testcase_21 AC 388 ms
96,816 KB
testcase_22 AC 233 ms
81,540 KB
testcase_23 AC 249 ms
82,320 KB
testcase_24 AC 1,555 ms
133,640 KB
testcase_25 AC 1,570 ms
133,932 KB
testcase_26 AC 1,586 ms
133,724 KB
testcase_27 AC 1,588 ms
133,852 KB
testcase_28 AC 1,578 ms
133,648 KB
testcase_29 AC 1,617 ms
133,872 KB
testcase_30 AC 1,567 ms
133,656 KB
testcase_31 AC 1,586 ms
133,876 KB
testcase_32 AC 1,615 ms
133,848 KB
testcase_33 AC 1,561 ms
133,848 KB
testcase_34 AC 70 ms
71,292 KB
testcase_35 AC 68 ms
71,340 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 i in range(n):
        for j in range(i+1,n):
            x1, y1 = balloons[i]
            x2, y2 = balloons[j]
            d = (x2-x1)**2+(y2-y1)**2
            dist.append((d, i, j))
        
    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