結果

問題 No.1265 Balloon Survival
ユーザー paruf4paruf4
提出日時 2020-10-24 00:06:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,363 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 1,206 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 154,980 KB
最終ジャッジ日時 2023-09-28 19:25:51
合計ジャッジ時間 19,124 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,216 KB
testcase_01 AC 79 ms
71,428 KB
testcase_02 AC 80 ms
71,428 KB
testcase_03 AC 77 ms
71,248 KB
testcase_04 AC 79 ms
71,456 KB
testcase_05 AC 77 ms
71,180 KB
testcase_06 AC 79 ms
71,164 KB
testcase_07 AC 78 ms
71,348 KB
testcase_08 AC 78 ms
71,368 KB
testcase_09 AC 78 ms
71,328 KB
testcase_10 AC 81 ms
71,252 KB
testcase_11 AC 80 ms
71,184 KB
testcase_12 AC 77 ms
71,508 KB
testcase_13 AC 78 ms
71,432 KB
testcase_14 AC 194 ms
88,012 KB
testcase_15 AC 147 ms
79,620 KB
testcase_16 AC 104 ms
76,596 KB
testcase_17 AC 644 ms
124,788 KB
testcase_18 AC 116 ms
77,608 KB
testcase_19 AC 106 ms
76,820 KB
testcase_20 AC 196 ms
87,632 KB
testcase_21 AC 311 ms
92,100 KB
testcase_22 AC 224 ms
91,924 KB
testcase_23 AC 234 ms
92,956 KB
testcase_24 AC 1,257 ms
154,860 KB
testcase_25 AC 1,275 ms
154,980 KB
testcase_26 AC 1,277 ms
154,832 KB
testcase_27 AC 1,256 ms
154,952 KB
testcase_28 AC 1,238 ms
154,896 KB
testcase_29 AC 1,286 ms
154,952 KB
testcase_30 AC 1,262 ms
154,948 KB
testcase_31 AC 1,363 ms
154,756 KB
testcase_32 AC 1,356 ms
154,732 KB
testcase_33 AC 1,261 ms
154,732 KB
testcase_34 AC 78 ms
71,584 KB
testcase_35 AC 77 ms
71,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
dist = []
for i in range(n):
    x1, y1 = xy[i]
    for j in range(i+1, n):
        x2, y2 = xy[j]
        d = (x1-x2)**2+(y1-y2)**2
        dist.append((d, i, j))
dist = sorted(dist, key=lambda x: x[0])
used = set()
res = 0
for _, i, j in dist:
    if i == 0:
        if j in used:
            continue
        else:
            res += 1
            used.add(j)
    else:
        if i in used or j in used:
            continue
        else:
            used.add(i)
            used.add(j)

print(res)
0