結果

問題 No.1265 Balloon Survival
ユーザー masa_aamasa_aa
提出日時 2020-10-23 22:22:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,327 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 718 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 152,964 KB
最終ジャッジ日時 2023-09-28 16:18:16
合計ジャッジ時間 18,402 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,336 KB
testcase_01 AC 77 ms
71,440 KB
testcase_02 AC 80 ms
71,196 KB
testcase_03 AC 80 ms
71,232 KB
testcase_04 AC 75 ms
71,368 KB
testcase_05 AC 79 ms
71,340 KB
testcase_06 AC 75 ms
71,236 KB
testcase_07 AC 74 ms
71,492 KB
testcase_08 AC 77 ms
71,440 KB
testcase_09 AC 77 ms
71,268 KB
testcase_10 AC 78 ms
71,348 KB
testcase_11 AC 76 ms
71,364 KB
testcase_12 AC 78 ms
71,332 KB
testcase_13 AC 76 ms
71,488 KB
testcase_14 AC 200 ms
87,396 KB
testcase_15 AC 146 ms
79,040 KB
testcase_16 AC 102 ms
76,556 KB
testcase_17 AC 665 ms
123,184 KB
testcase_18 AC 118 ms
77,656 KB
testcase_19 AC 104 ms
76,624 KB
testcase_20 AC 165 ms
80,460 KB
testcase_21 AC 305 ms
94,408 KB
testcase_22 AC 225 ms
92,288 KB
testcase_23 AC 241 ms
93,472 KB
testcase_24 AC 1,291 ms
152,872 KB
testcase_25 AC 1,327 ms
152,688 KB
testcase_26 AC 1,289 ms
152,868 KB
testcase_27 AC 1,284 ms
152,940 KB
testcase_28 AC 1,248 ms
152,848 KB
testcase_29 AC 1,307 ms
152,852 KB
testcase_30 AC 1,225 ms
152,884 KB
testcase_31 AC 1,311 ms
152,964 KB
testcase_32 AC 1,241 ms
152,688 KB
testcase_33 AC 1,251 ms
152,832 KB
testcase_34 AC 77 ms
71,436 KB
testcase_35 AC 76 ms
71,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
# def input(): return sys.stdin.readline().rstrip() # 文字列


def dist(x, y):
    one = x[0] - y[0]
    two = x[1] - y[1]
    return one * one + two * two


n = int(input())
p = [tuple(map(int, input().split())) for i in range(n)]
d = []
for i in range(n - 1):
    for j in range(i + 1, n):
        d.append((dist(p[i], p[j]), i, j))

d.sort(key=lambda x: x[0])
s = set(range(n))
ans = 0
i = 0
while len(s) > 1:
    _, x, y = d[i]
    if x == 0 or y == 0:
        if x + y in s:
            s.remove(x + y)
            ans += 1

    elif x in s and y in s:
        s.remove(x)
        s.remove(y)
    i += 1
print(ans)
0