結果

問題 No.1265 Balloon Survival
ユーザー ntudantuda
提出日時 2022-03-12 10:30:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,187 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 563 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 150,952 KB
最終ジャッジ日時 2023-10-14 22:27:15
合計ジャッジ時間 17,655 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,272 KB
testcase_01 AC 78 ms
71,224 KB
testcase_02 AC 77 ms
71,024 KB
testcase_03 AC 79 ms
70,988 KB
testcase_04 AC 78 ms
71,228 KB
testcase_05 AC 79 ms
71,312 KB
testcase_06 AC 79 ms
71,320 KB
testcase_07 AC 77 ms
71,320 KB
testcase_08 AC 78 ms
71,428 KB
testcase_09 AC 77 ms
71,136 KB
testcase_10 AC 76 ms
70,968 KB
testcase_11 AC 78 ms
70,956 KB
testcase_12 AC 78 ms
70,984 KB
testcase_13 AC 78 ms
71,404 KB
testcase_14 AC 169 ms
80,200 KB
testcase_15 AC 138 ms
79,004 KB
testcase_16 AC 104 ms
76,236 KB
testcase_17 AC 598 ms
122,440 KB
testcase_18 AC 116 ms
77,636 KB
testcase_19 AC 105 ms
76,712 KB
testcase_20 AC 167 ms
80,208 KB
testcase_21 AC 277 ms
93,168 KB
testcase_22 AC 202 ms
91,780 KB
testcase_23 AC 226 ms
92,376 KB
testcase_24 AC 1,186 ms
150,704 KB
testcase_25 AC 1,156 ms
150,572 KB
testcase_26 AC 1,124 ms
150,748 KB
testcase_27 AC 1,111 ms
150,576 KB
testcase_28 AC 1,132 ms
150,368 KB
testcase_29 AC 1,187 ms
150,652 KB
testcase_30 AC 1,125 ms
150,880 KB
testcase_31 AC 1,133 ms
150,720 KB
testcase_32 AC 1,132 ms
150,592 KB
testcase_33 AC 1,117 ms
150,952 KB
testcase_34 AC 73 ms
71,100 KB
testcase_35 AC 77 ms
71,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
D = []

for i in range(N - 1):
    x1, y1 = XY[i]
    for j in range(i + 1, N):
        x2, y2 = XY[j]
        d2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)
        D.append((d2, i, j))
D.sort(key = lambda x:x[0])
cnt = 0
removed = [0] * N
for d, i, j in D:
    if removed[i] or removed[j]:
        continue
    if i == 0:
        removed[j] = 1
        cnt += 1
    else:
        removed[i] = 1
        removed[j] = 1
print(cnt)
0