結果

問題 No.1265 Balloon Survival
ユーザー r_ishidar_ishida
提出日時 2020-12-30 07:28:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,365 ms / 2,000 ms
コード長 742 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 148,688 KB
最終ジャッジ日時 2024-04-16 03:40:10
合計ジャッジ時間 17,103 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,864 KB
testcase_01 AC 44 ms
52,608 KB
testcase_02 AC 44 ms
52,608 KB
testcase_03 AC 41 ms
52,736 KB
testcase_04 AC 40 ms
52,480 KB
testcase_05 AC 41 ms
52,948 KB
testcase_06 AC 40 ms
52,224 KB
testcase_07 AC 41 ms
52,736 KB
testcase_08 AC 41 ms
52,352 KB
testcase_09 AC 44 ms
52,608 KB
testcase_10 AC 41 ms
52,608 KB
testcase_11 AC 40 ms
52,480 KB
testcase_12 AC 45 ms
52,864 KB
testcase_13 AC 41 ms
52,608 KB
testcase_14 AC 129 ms
76,544 KB
testcase_15 AC 105 ms
71,936 KB
testcase_16 AC 67 ms
65,536 KB
testcase_17 AC 604 ms
121,176 KB
testcase_18 AC 77 ms
67,968 KB
testcase_19 AC 68 ms
66,048 KB
testcase_20 AC 127 ms
76,544 KB
testcase_21 AC 257 ms
94,720 KB
testcase_22 AC 194 ms
89,940 KB
testcase_23 AC 193 ms
92,672 KB
testcase_24 AC 1,208 ms
148,560 KB
testcase_25 AC 1,365 ms
148,688 KB
testcase_26 AC 1,223 ms
148,308 KB
testcase_27 AC 1,250 ms
148,436 KB
testcase_28 AC 1,285 ms
148,560 KB
testcase_29 AC 1,296 ms
148,300 KB
testcase_30 AC 1,250 ms
148,304 KB
testcase_31 AC 1,238 ms
148,436 KB
testcase_32 AC 1,292 ms
148,168 KB
testcase_33 AC 1,310 ms
148,428 KB
testcase_34 AC 42 ms
52,608 KB
testcase_35 AC 41 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N = I()
XY = [()] * N
for i in range(N):
    x, y = MI()
    XY[i] = (x, y)

edges = []
for i, (x, y) in enumerate(XY):
    for j, (x2, y2) in enumerate(XY[i+1:], i+1):
        dist = (x-x2)**2 + (y-y2)**2
        edges.append((dist, i, j))

edges.sort(key=itemgetter(0))
removed = [0] * N
ans = 0
for dist, a, b in edges:
    if removed[a] or removed[b]:
        continue
    if a == 0:
        ans += 1
        removed[b] = 1
    elif b == 0:
        ans += 1
        removed[a] = 1
    else:
        removed[a] = 1
        removed[b] = 1
print(ans)
0