結果

問題 No.1265 Balloon Survival
ユーザー 👑 KazunKazun
提出日時 2020-10-23 23:33:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,914 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 127,048 KB
最終ジャッジ日時 2023-09-28 18:49:16
合計ジャッジ時間 24,415 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,224 KB
testcase_01 AC 99 ms
71,188 KB
testcase_02 AC 98 ms
71,400 KB
testcase_03 AC 99 ms
71,580 KB
testcase_04 AC 99 ms
71,568 KB
testcase_05 AC 99 ms
71,596 KB
testcase_06 AC 99 ms
71,688 KB
testcase_07 AC 98 ms
71,508 KB
testcase_08 AC 98 ms
71,688 KB
testcase_09 AC 97 ms
71,516 KB
testcase_10 AC 97 ms
71,220 KB
testcase_11 AC 100 ms
71,564 KB
testcase_12 AC 96 ms
71,492 KB
testcase_13 AC 97 ms
71,368 KB
testcase_14 AC 231 ms
78,668 KB
testcase_15 AC 194 ms
78,064 KB
testcase_16 AC 138 ms
77,096 KB
testcase_17 AC 878 ms
100,252 KB
testcase_18 AC 155 ms
77,400 KB
testcase_19 AC 141 ms
77,156 KB
testcase_20 AC 235 ms
78,792 KB
testcase_21 AC 394 ms
80,284 KB
testcase_22 AC 279 ms
79,008 KB
testcase_23 AC 294 ms
79,356 KB
testcase_24 AC 1,783 ms
125,836 KB
testcase_25 AC 1,785 ms
126,760 KB
testcase_26 AC 1,789 ms
127,048 KB
testcase_27 AC 1,792 ms
126,648 KB
testcase_28 AC 1,914 ms
126,888 KB
testcase_29 AC 1,798 ms
126,996 KB
testcase_30 AC 1,737 ms
126,948 KB
testcase_31 AC 1,766 ms
126,672 KB
testcase_32 AC 1,776 ms
126,484 KB
testcase_33 AC 1,726 ms
126,424 KB
testcase_34 AC 96 ms
71,644 KB
testcase_35 AC 95 ms
71,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

def dist(P,Q):
    a,b=P[0]-Q[0],P[1]-Q[1]
    return a*a+b*b

N=int(input())
P=[0]*N

for i in range(N):
    P[i]=tuple(map(int,input().split()))

Q=[0]*(N*(N-1)//2)
k=0
for i in range(N):
    for j in range(i+1,N):
        Q[k]=(dist(P[i],P[j]),j,i)
        k+=1

Q.sort()
Q=deque(Q)
Flag=[True for _ in range(N)]

X=0
while Q:
    (_,j,i)=Q.popleft()

    if not(Flag[i] and Flag[j]):
        continue

    Flag[j]=False
    if i!=0:
        Flag[i]=False
    if i==0:
        X+=1
print(X)
0