結果

問題 No.1265 Balloon Survival
ユーザー 👑 tamatotamato
提出日時 2020-10-23 22:12:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,133 ms / 2,000 ms
コード長 801 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,536 KB
実行使用メモリ 140,200 KB
最終ジャッジ日時 2023-09-28 16:01:23
合計ジャッジ時間 15,941 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,844 KB
testcase_01 AC 76 ms
71,692 KB
testcase_02 AC 77 ms
71,552 KB
testcase_03 AC 79 ms
71,404 KB
testcase_04 AC 76 ms
71,540 KB
testcase_05 AC 76 ms
71,972 KB
testcase_06 AC 75 ms
71,784 KB
testcase_07 AC 76 ms
71,568 KB
testcase_08 AC 74 ms
71,684 KB
testcase_09 AC 77 ms
71,900 KB
testcase_10 AC 78 ms
71,412 KB
testcase_11 AC 78 ms
71,532 KB
testcase_12 AC 76 ms
71,892 KB
testcase_13 AC 78 ms
71,732 KB
testcase_14 AC 159 ms
80,572 KB
testcase_15 AC 132 ms
78,932 KB
testcase_16 AC 100 ms
76,456 KB
testcase_17 AC 547 ms
102,380 KB
testcase_18 AC 116 ms
77,796 KB
testcase_19 AC 102 ms
76,704 KB
testcase_20 AC 156 ms
80,712 KB
testcase_21 AC 286 ms
97,080 KB
testcase_22 AC 186 ms
82,428 KB
testcase_23 AC 229 ms
91,576 KB
testcase_24 AC 1,081 ms
138,368 KB
testcase_25 AC 1,080 ms
139,300 KB
testcase_26 AC 1,120 ms
140,200 KB
testcase_27 AC 1,072 ms
139,476 KB
testcase_28 AC 1,050 ms
139,968 KB
testcase_29 AC 1,105 ms
139,980 KB
testcase_30 AC 1,097 ms
139,832 KB
testcase_31 AC 1,078 ms
139,676 KB
testcase_32 AC 1,133 ms
139,156 KB
testcase_33 AC 1,070 ms
139,460 KB
testcase_34 AC 75 ms
71,860 KB
testcase_35 AC 75 ms
71,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from math import hypot
    input = sys.stdin.readline

    N = int(input())
    X = []
    Y = []
    for _ in range(N):
        x, y = map(int, input().split())
        X.append(x)
        Y.append(y)

    ev = []
    for i in range(N):
        xi, yi = X[i], Y[i]
        for j in range(i+1, N):
            xj, yj = X[j], Y[j]
            ev.append(((xi-xj)**2 + (yi-yj) ** 2, i, j))
    ev.sort(key=lambda x: x[0])
    seen = [0] * N
    ans = 0
    for _, i, j in ev:
        if i == 0:
            if not seen[j]:
                ans += 1
                seen[j] = 1
        else:
            if seen[i] == seen[j] == 0:
                seen[i] = 1
                seen[j] = 1
    print(ans)


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