結果

問題 No.1265 Balloon Survival
ユーザー taiga000629taiga000629
提出日時 2020-10-24 00:48:17
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 704 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 131,616 KB
最終ジャッジ日時 2023-09-28 19:49:33
合計ジャッジ時間 26,171 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,412 KB
testcase_01 AC 77 ms
71,432 KB
testcase_02 AC 78 ms
71,352 KB
testcase_03 AC 79 ms
71,164 KB
testcase_04 AC 78 ms
71,356 KB
testcase_05 AC 78 ms
71,536 KB
testcase_06 AC 78 ms
71,128 KB
testcase_07 AC 78 ms
71,176 KB
testcase_08 AC 77 ms
71,220 KB
testcase_09 AC 78 ms
71,296 KB
testcase_10 AC 78 ms
71,364 KB
testcase_11 AC 77 ms
71,216 KB
testcase_12 AC 77 ms
71,156 KB
testcase_13 AC 79 ms
71,012 KB
testcase_14 AC 246 ms
83,440 KB
testcase_15 AC 194 ms
81,832 KB
testcase_16 AC 116 ms
76,244 KB
testcase_17 AC 986 ms
105,696 KB
testcase_18 AC 143 ms
79,544 KB
testcase_19 AC 121 ms
76,272 KB
testcase_20 AC 236 ms
83,472 KB
testcase_21 AC 471 ms
91,196 KB
testcase_22 AC 303 ms
86,004 KB
testcase_23 AC 330 ms
86,480 KB
testcase_24 TLE -
testcase_25 AC 1,981 ms
131,376 KB
testcase_26 AC 1,992 ms
131,188 KB
testcase_27 TLE -
testcase_28 AC 1,990 ms
131,188 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 1,982 ms
131,196 KB
testcase_34 AC 79 ms
71,208 KB
testcase_35 AC 80 ms
71,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
xy=[[0,0] for i in range(n)]
import sys
input=sys.stdin.readline #文字列入力はするな!

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

    xy[i][0]=x
    xy[i][1]=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=xy[i][0],xy[i][1],xy[j][0],xy[j][1]
        dis[cnt][0]=(xi-xj)**2+(yi-yj)**2
        dis[cnt][1]=i
        dis[cnt][2]=j
        cnt+=1
dis.sort()
erase=[0]*(n)
for i in range(len(dis)):
    p,q=dis[i][1],dis[i][2]
    if p==0:
        if erase[q]==0:
            ans+=1
            erase[q]=1
    else:
        if erase[p]==erase[q]==0:
            erase[p] = erase[q]=1

print(ans)

0