結果

問題 No.1265 Balloon Survival
ユーザー 👑 rin204rin204
提出日時 2022-04-03 21:52:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,759 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 136,184 KB
最終ジャッジ日時 2023-08-15 20:50:36
合計ジャッジ時間 23,522 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,248 KB
testcase_01 AC 76 ms
71,256 KB
testcase_02 AC 75 ms
71,336 KB
testcase_03 AC 75 ms
71,484 KB
testcase_04 AC 75 ms
71,292 KB
testcase_05 AC 76 ms
71,260 KB
testcase_06 AC 78 ms
71,428 KB
testcase_07 AC 74 ms
71,276 KB
testcase_08 AC 75 ms
71,244 KB
testcase_09 AC 74 ms
71,312 KB
testcase_10 AC 75 ms
71,376 KB
testcase_11 AC 73 ms
71,528 KB
testcase_12 AC 73 ms
71,244 KB
testcase_13 AC 74 ms
71,316 KB
testcase_14 AC 207 ms
80,484 KB
testcase_15 AC 167 ms
78,636 KB
testcase_16 AC 108 ms
76,256 KB
testcase_17 AC 791 ms
103,408 KB
testcase_18 AC 130 ms
77,332 KB
testcase_19 AC 114 ms
76,440 KB
testcase_20 AC 206 ms
80,268 KB
testcase_21 AC 423 ms
95,944 KB
testcase_22 AC 252 ms
81,928 KB
testcase_23 AC 269 ms
82,596 KB
testcase_24 AC 1,690 ms
133,976 KB
testcase_25 AC 1,759 ms
134,988 KB
testcase_26 AC 1,699 ms
135,968 KB
testcase_27 AC 1,692 ms
135,076 KB
testcase_28 AC 1,644 ms
136,096 KB
testcase_29 AC 1,691 ms
136,184 KB
testcase_30 AC 1,713 ms
136,152 KB
testcase_31 AC 1,672 ms
135,020 KB
testcase_32 AC 1,693 ms
135,300 KB
testcase_33 AC 1,681 ms
135,320 KB
testcase_34 AC 74 ms
71,340 KB
testcase_35 AC 74 ms
71,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

n = int(input())
X = [0] * n
Y = [0] * n
for i in range(n):
    X[i], Y[i] = map(int, input().split())
dist = []
for i in range(n):
    for j in range(i + 1, n):
        dx = X[j] - X[i]
        dy = Y[j] - Y[i]
        dist.append((dx ** 2 + dy ** 2, i, j))
        
dist.sort()
used = [False] * n
ans = 0
for _, i, j in dist:
    if i == 0:
        if not used[j]:
            ans += 1
            used[j] = True
    elif not used[i] and not used[j]:
        used[i] = used[j] = True
    else:
        pass
print(ans)
0