結果

問題 No.1265 Balloon Survival
ユーザー taiga000629taiga000629
提出日時 2020-10-24 01:03:54
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 698 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 131,768 KB
最終ジャッジ日時 2023-09-28 19:53:24
合計ジャッジ時間 27,317 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,144 KB
testcase_01 AC 77 ms
71,364 KB
testcase_02 AC 76 ms
71,428 KB
testcase_03 AC 79 ms
71,532 KB
testcase_04 AC 75 ms
71,404 KB
testcase_05 AC 78 ms
71,304 KB
testcase_06 AC 77 ms
71,204 KB
testcase_07 AC 76 ms
71,344 KB
testcase_08 AC 75 ms
71,220 KB
testcase_09 AC 75 ms
71,464 KB
testcase_10 AC 76 ms
71,364 KB
testcase_11 AC 76 ms
71,492 KB
testcase_12 AC 77 ms
71,220 KB
testcase_13 AC 76 ms
71,116 KB
testcase_14 AC 243 ms
83,444 KB
testcase_15 AC 191 ms
81,732 KB
testcase_16 AC 113 ms
76,204 KB
testcase_17 AC 1,002 ms
105,808 KB
testcase_18 AC 139 ms
79,732 KB
testcase_19 AC 120 ms
76,152 KB
testcase_20 AC 235 ms
83,100 KB
testcase_21 AC 478 ms
91,004 KB
testcase_22 AC 298 ms
86,144 KB
testcase_23 AC 329 ms
86,776 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 AC 76 ms
71,304 KB
testcase_35 AC 74 ms
71,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
X=[0]*n
Y=[0]*n
import sys
input=sys.stdin.readline #文字列入力はするな!

for i in range(n):
    x,y=map(int,input().split())

    X[i]=x
    Y[i]=y
ans=0

dis=[[0,0,0] for i in range(n*(n-1)//2)]
cnt=0
for i in range(n-1):
    for j in range(i+1,n):
        xi,yi,xj,yj=X[i],Y[i],X[j],Y[j]
        dis[cnt][0]=(xi-xj)**2+(yi-yj)**2
        dis[cnt][1]=i
        dis[cnt][2]=j
        cnt+=1
dis.sort()
erase=set()
for i in range(len(dis)):
    p,q=dis[i][1],dis[i][2]
    if p==0:
        if not q in erase:
            ans+=1
            erase.add(q)
    else:
        if not p in erase and not q in erase:
            erase.add(p)
            erase.add(q)

print(ans)

0