結果

問題 No.1265 Balloon Survival
ユーザー gr1msl3ygr1msl3y
提出日時 2022-05-22 21:01:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 968 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 147,328 KB
最終ジャッジ日時 2023-10-20 17:18:59
合計ジャッジ時間 12,673 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,468 KB
testcase_01 AC 38 ms
53,468 KB
testcase_02 AC 35 ms
53,468 KB
testcase_03 AC 34 ms
53,468 KB
testcase_04 AC 34 ms
53,468 KB
testcase_05 AC 34 ms
53,468 KB
testcase_06 AC 35 ms
53,468 KB
testcase_07 AC 38 ms
53,468 KB
testcase_08 AC 33 ms
53,468 KB
testcase_09 AC 36 ms
53,468 KB
testcase_10 AC 37 ms
53,468 KB
testcase_11 AC 35 ms
53,468 KB
testcase_12 AC 34 ms
53,468 KB
testcase_13 AC 33 ms
53,468 KB
testcase_14 AC 100 ms
76,136 KB
testcase_15 AC 87 ms
72,696 KB
testcase_16 AC 55 ms
66,144 KB
testcase_17 AC 432 ms
121,120 KB
testcase_18 AC 68 ms
69,284 KB
testcase_19 AC 59 ms
66,296 KB
testcase_20 AC 97 ms
76,152 KB
testcase_21 AC 203 ms
95,336 KB
testcase_22 AC 151 ms
88,060 KB
testcase_23 AC 160 ms
92,280 KB
testcase_24 AC 859 ms
147,308 KB
testcase_25 AC 876 ms
147,292 KB
testcase_26 AC 877 ms
147,292 KB
testcase_27 AC 934 ms
147,292 KB
testcase_28 AC 924 ms
147,296 KB
testcase_29 AC 968 ms
147,288 KB
testcase_30 AC 919 ms
147,292 KB
testcase_31 AC 920 ms
147,328 KB
testcase_32 AC 926 ms
147,292 KB
testcase_33 AC 855 ms
147,292 KB
testcase_34 AC 37 ms
53,524 KB
testcase_35 AC 36 ms
53,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    A = [list(map(int, input().split())) for _ in range(N)]
    seen = [0]*N

    task = []
    for i in range(N):
        xi, yi = A[i]
        for j in range(i+1, N):
            xj, yj = A[j]
            d = (xi-xj)**2+(yi-yj)**2
            task.append([d, i, j])

    task.sort(key=lambda x: x[0])
    ans = 0
    for _, indi, indj in task:
        if seen[indi] or seen[indj]:
            continue
        if indi > 0:
            seen[indi] = seen[indj] = 1
        else:
            ans += 1
            seen[indj] += 1

    print(ans)


main()
0