結果

問題 No.1265 Balloon Survival
ユーザー Coki628Coki628
提出日時 2020-12-05 01:57:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 980 ms / 2,000 ms
コード長 1,247 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 148,308 KB
最終ジャッジ日時 2023-10-13 13:04:32
合計ジャッジ時間 12,865 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,292 KB
testcase_01 AC 64 ms
71,756 KB
testcase_02 AC 66 ms
71,320 KB
testcase_03 AC 65 ms
71,692 KB
testcase_04 AC 68 ms
71,692 KB
testcase_05 AC 71 ms
71,652 KB
testcase_06 AC 67 ms
71,456 KB
testcase_07 AC 65 ms
71,672 KB
testcase_08 AC 66 ms
71,460 KB
testcase_09 AC 66 ms
71,564 KB
testcase_10 AC 67 ms
71,328 KB
testcase_11 AC 63 ms
71,708 KB
testcase_12 AC 63 ms
71,668 KB
testcase_13 AC 63 ms
71,320 KB
testcase_14 AC 144 ms
88,112 KB
testcase_15 AC 108 ms
79,176 KB
testcase_16 AC 82 ms
76,940 KB
testcase_17 AC 441 ms
120,096 KB
testcase_18 AC 92 ms
77,644 KB
testcase_19 AC 84 ms
76,908 KB
testcase_20 AC 141 ms
88,292 KB
testcase_21 AC 215 ms
91,028 KB
testcase_22 AC 156 ms
90,112 KB
testcase_23 AC 166 ms
89,948 KB
testcase_24 AC 833 ms
147,960 KB
testcase_25 AC 841 ms
148,184 KB
testcase_26 AC 845 ms
148,120 KB
testcase_27 AC 841 ms
148,184 KB
testcase_28 AC 892 ms
148,308 KB
testcase_29 AC 980 ms
148,224 KB
testcase_30 AC 877 ms
148,172 KB
testcase_31 AC 857 ms
148,064 KB
testcase_32 AC 917 ms
148,164 KB
testcase_33 AC 877 ms
148,180 KB
testcase_34 AC 67 ms
71,484 KB
testcase_35 AC 65 ms
71,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

N = INT()
XY = [()] * N
for i in range(N):
    x, y = MAP()
    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