結果

問題 No.1265 Balloon Survival
ユーザー lloyzlloyz
提出日時 2022-05-26 00:34:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 81,688 KB
実行使用メモリ 129,764 KB
最終ジャッジ日時 2023-10-20 19:18:04
合計ジャッジ時間 21,787 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,600 KB
testcase_01 AC 39 ms
53,600 KB
testcase_02 AC 39 ms
53,536 KB
testcase_03 AC 39 ms
53,600 KB
testcase_04 AC 39 ms
53,600 KB
testcase_05 AC 38 ms
53,600 KB
testcase_06 AC 39 ms
53,600 KB
testcase_07 AC 39 ms
53,600 KB
testcase_08 AC 39 ms
53,600 KB
testcase_09 AC 38 ms
53,600 KB
testcase_10 AC 39 ms
53,600 KB
testcase_11 AC 38 ms
53,600 KB
testcase_12 AC 39 ms
53,600 KB
testcase_13 AC 39 ms
53,600 KB
testcase_14 AC 175 ms
74,200 KB
testcase_15 AC 138 ms
70,740 KB
testcase_16 AC 76 ms
64,312 KB
testcase_17 AC 797 ms
100,724 KB
testcase_18 AC 97 ms
67,328 KB
testcase_19 AC 81 ms
64,464 KB
testcase_20 AC 173 ms
74,196 KB
testcase_21 AC 400 ms
95,560 KB
testcase_22 AC 220 ms
77,844 KB
testcase_23 AC 240 ms
78,620 KB
testcase_24 AC 1,760 ms
128,616 KB
testcase_25 AC 1,754 ms
128,780 KB
testcase_26 AC 1,749 ms
129,748 KB
testcase_27 AC 1,741 ms
128,744 KB
testcase_28 AC 1,744 ms
129,760 KB
testcase_29 AC 1,771 ms
129,764 KB
testcase_30 AC 1,712 ms
129,760 KB
testcase_31 AC 1,717 ms
128,744 KB
testcase_32 AC 1,771 ms
128,812 KB
testcase_33 AC 1,707 ms
128,796 KB
testcase_34 AC 40 ms
53,600 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

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