結果

問題 No.1265 Balloon Survival
ユーザー lloyzlloyz
提出日時 2022-05-26 00:35:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 686 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 138,644 KB
最終ジャッジ日時 2023-10-20 19:18:27
合計ジャッジ時間 14,171 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,712 KB
testcase_01 AC 38 ms
53,712 KB
testcase_02 AC 37 ms
53,648 KB
testcase_03 AC 37 ms
53,712 KB
testcase_04 AC 38 ms
53,712 KB
testcase_05 AC 37 ms
53,712 KB
testcase_06 AC 38 ms
53,712 KB
testcase_07 AC 39 ms
53,712 KB
testcase_08 AC 37 ms
53,712 KB
testcase_09 AC 38 ms
53,712 KB
testcase_10 AC 37 ms
53,712 KB
testcase_11 AC 38 ms
53,712 KB
testcase_12 AC 38 ms
53,712 KB
testcase_13 AC 38 ms
53,712 KB
testcase_14 AC 120 ms
74,468 KB
testcase_15 AC 98 ms
71,008 KB
testcase_16 AC 61 ms
64,564 KB
testcase_17 AC 493 ms
101,032 KB
testcase_18 AC 73 ms
67,596 KB
testcase_19 AC 63 ms
64,716 KB
testcase_20 AC 122 ms
74,464 KB
testcase_21 AC 255 ms
97,108 KB
testcase_22 AC 152 ms
78,112 KB
testcase_23 AC 165 ms
79,268 KB
testcase_24 AC 1,063 ms
137,056 KB
testcase_25 AC 1,065 ms
138,116 KB
testcase_26 AC 1,050 ms
138,636 KB
testcase_27 AC 1,040 ms
138,116 KB
testcase_28 AC 1,054 ms
138,644 KB
testcase_29 AC 1,098 ms
138,640 KB
testcase_30 AC 1,060 ms
138,632 KB
testcase_31 AC 1,045 ms
138,112 KB
testcase_32 AC 1,098 ms
138,112 KB
testcase_33 AC 1,051 ms
138,060 KB
testcase_34 AC 38 ms
53,712 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

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((sqrt((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