結果

問題 No.1265 Balloon Survival
ユーザー 👑 KazunKazun
提出日時 2020-10-23 23:43:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,961 ms / 2,000 ms
コード長 648 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 128,168 KB
最終ジャッジ日時 2023-09-28 19:03:27
合計ジャッジ時間 26,178 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,596 KB
testcase_01 AC 96 ms
71,692 KB
testcase_02 AC 96 ms
71,764 KB
testcase_03 AC 96 ms
71,956 KB
testcase_04 AC 98 ms
71,508 KB
testcase_05 AC 97 ms
71,860 KB
testcase_06 AC 98 ms
71,904 KB
testcase_07 AC 97 ms
71,396 KB
testcase_08 AC 95 ms
71,884 KB
testcase_09 AC 96 ms
71,796 KB
testcase_10 AC 100 ms
71,904 KB
testcase_11 AC 100 ms
71,412 KB
testcase_12 AC 97 ms
71,712 KB
testcase_13 AC 96 ms
71,828 KB
testcase_14 AC 227 ms
78,784 KB
testcase_15 AC 195 ms
78,572 KB
testcase_16 AC 136 ms
77,324 KB
testcase_17 AC 902 ms
101,136 KB
testcase_18 AC 152 ms
77,444 KB
testcase_19 AC 139 ms
77,480 KB
testcase_20 AC 223 ms
78,436 KB
testcase_21 AC 387 ms
80,096 KB
testcase_22 AC 274 ms
79,492 KB
testcase_23 AC 300 ms
79,632 KB
testcase_24 AC 1,904 ms
126,484 KB
testcase_25 AC 1,929 ms
127,636 KB
testcase_26 AC 1,874 ms
127,864 KB
testcase_27 AC 1,917 ms
127,652 KB
testcase_28 AC 1,919 ms
128,116 KB
testcase_29 AC 1,961 ms
128,012 KB
testcase_30 AC 1,890 ms
128,168 KB
testcase_31 AC 1,895 ms
127,572 KB
testcase_32 AC 1,961 ms
127,480 KB
testcase_33 AC 1,930 ms
127,504 KB
testcase_34 AC 100 ms
71,884 KB
testcase_35 AC 99 ms
71,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import sys

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

def main():
    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
        else:
            X+=1
    print(X)

main()
0