結果

問題 No.1265 Balloon Survival
ユーザー ayaoniayaoni
提出日時 2020-10-24 07:25:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,669 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 1,713 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 142,700 KB
最終ジャッジ日時 2023-09-28 20:09:26
合計ジャッジ時間 23,951 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,380 KB
testcase_01 AC 74 ms
70,992 KB
testcase_02 AC 75 ms
71,256 KB
testcase_03 AC 75 ms
71,356 KB
testcase_04 AC 78 ms
71,148 KB
testcase_05 AC 75 ms
71,172 KB
testcase_06 AC 74 ms
71,360 KB
testcase_07 AC 75 ms
71,252 KB
testcase_08 AC 75 ms
70,992 KB
testcase_09 AC 75 ms
71,316 KB
testcase_10 AC 76 ms
71,272 KB
testcase_11 AC 75 ms
71,304 KB
testcase_12 AC 75 ms
71,208 KB
testcase_13 AC 76 ms
71,244 KB
testcase_14 AC 235 ms
82,984 KB
testcase_15 AC 178 ms
82,520 KB
testcase_16 AC 104 ms
76,132 KB
testcase_17 AC 788 ms
109,772 KB
testcase_18 AC 135 ms
79,860 KB
testcase_19 AC 114 ms
76,492 KB
testcase_20 AC 205 ms
82,976 KB
testcase_21 AC 394 ms
94,500 KB
testcase_22 AC 264 ms
87,344 KB
testcase_23 AC 278 ms
88,884 KB
testcase_24 AC 1,621 ms
141,016 KB
testcase_25 AC 1,613 ms
141,652 KB
testcase_26 AC 1,608 ms
142,416 KB
testcase_27 AC 1,630 ms
141,840 KB
testcase_28 AC 1,623 ms
142,136 KB
testcase_29 AC 1,621 ms
142,700 KB
testcase_30 AC 1,613 ms
142,340 KB
testcase_31 AC 1,623 ms
142,236 KB
testcase_32 AC 1,669 ms
141,892 KB
testcase_33 AC 1,598 ms
141,832 KB
testcase_34 AC 76 ms
71,268 KB
testcase_35 AC 75 ms
71,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


N = I()
xy = [tuple(MI()) for _ in range(N)]
dist = []
for i in range(N-1):
    x0,y0 = xy[i]
    for j in range(i+1,N):
        x1,y1 = xy[j]
        dist.append((((x0-x1)**2+(y0-y1)**2)<<20) + (i<<10) + j)

dist.sort()
left = [1]*N

ans = 0
for a in dist:
    i = (a>>10)&((1<<10)-1)
    j = a&((1<<10)-1)
    if left[i] == 0 or left[j] == 0:
        continue
    if i == 0:
        ans += 1
        left[j] = 0
    else:
        left[i] = 0
        left[j] = 0

print(ans)
0