結果

問題 No.1265 Balloon Survival
ユーザー lloyzlloyz
提出日時 2022-05-26 00:36:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,022 ms / 2,000 ms
コード長 680 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,652 KB
実行使用メモリ 138,420 KB
最終ジャッジ日時 2023-10-20 19:18:43
合計ジャッジ時間 13,280 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,516 KB
testcase_01 AC 35 ms
53,516 KB
testcase_02 AC 35 ms
53,516 KB
testcase_03 AC 38 ms
53,516 KB
testcase_04 AC 38 ms
53,516 KB
testcase_05 AC 38 ms
53,516 KB
testcase_06 AC 37 ms
53,516 KB
testcase_07 AC 35 ms
53,516 KB
testcase_08 AC 37 ms
53,516 KB
testcase_09 AC 37 ms
53,516 KB
testcase_10 AC 39 ms
53,516 KB
testcase_11 AC 37 ms
53,516 KB
testcase_12 AC 38 ms
53,516 KB
testcase_13 AC 36 ms
53,516 KB
testcase_14 AC 112 ms
74,148 KB
testcase_15 AC 92 ms
70,688 KB
testcase_16 AC 57 ms
64,260 KB
testcase_17 AC 452 ms
100,808 KB
testcase_18 AC 67 ms
67,276 KB
testcase_19 AC 61 ms
64,412 KB
testcase_20 AC 112 ms
74,144 KB
testcase_21 AC 239 ms
96,744 KB
testcase_22 AC 147 ms
77,792 KB
testcase_23 AC 150 ms
78,832 KB
testcase_24 AC 964 ms
136,836 KB
testcase_25 AC 952 ms
137,892 KB
testcase_26 AC 987 ms
138,156 KB
testcase_27 AC 965 ms
137,892 KB
testcase_28 AC 994 ms
138,156 KB
testcase_29 AC 1,006 ms
138,420 KB
testcase_30 AC 948 ms
138,156 KB
testcase_31 AC 977 ms
137,896 KB
testcase_32 AC 1,022 ms
137,892 KB
testcase_33 AC 969 ms
137,896 KB
testcase_34 AC 37 ms
53,516 KB
testcase_35 AC 36 ms
53,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
import sys

input = sys.stdin.readline

def main():
    n = int(input())
    P = [list(map(int, input().split())) for _ in range(n)]

    L = []
    for i in range(n):
        for j in range(i + 1, n):
            L.append(((P[i][0] - P[j][0])**2 + (P[i][1] - P[j][1])**2, i, j))

    L.sort(key=lambda x: x[0])
    seen = set()
    ans = 0
    for _, i, j in L:
        if i == 0:
            if j in seen:
                continue
            ans += 1
            seen.add(j)
        else:
            if i in seen or j in seen:
                continue
            seen.add(i)
            seen.add(j)
    print(ans)

if __name__ == '__main__':
    main()
0