結果

問題 No.1265 Balloon Survival
ユーザー 👑 timitimi
提出日時 2020-12-18 15:10:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,549 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 11,988 KB
実行使用メモリ 75,768 KB
最終ジャッジ日時 2023-10-21 08:07:35
合計ジャッジ時間 19,541 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,152 KB
testcase_01 AC 30 ms
10,152 KB
testcase_02 AC 29 ms
10,152 KB
testcase_03 AC 26 ms
10,152 KB
testcase_04 AC 26 ms
10,152 KB
testcase_05 AC 26 ms
10,164 KB
testcase_06 AC 27 ms
10,156 KB
testcase_07 AC 25 ms
10,156 KB
testcase_08 AC 25 ms
10,156 KB
testcase_09 AC 27 ms
10,152 KB
testcase_10 AC 25 ms
10,152 KB
testcase_11 AC 25 ms
10,160 KB
testcase_12 AC 27 ms
10,164 KB
testcase_13 AC 29 ms
10,156 KB
testcase_14 AC 162 ms
18,084 KB
testcase_15 AC 120 ms
15,964 KB
testcase_16 AC 60 ms
12,256 KB
testcase_17 AC 785 ms
44,620 KB
testcase_18 AC 77 ms
13,304 KB
testcase_19 AC 62 ms
12,520 KB
testcase_20 AC 155 ms
17,820 KB
testcase_21 AC 351 ms
26,772 KB
testcase_22 AC 226 ms
20,564 KB
testcase_23 AC 239 ms
21,532 KB
testcase_24 AC 1,528 ms
74,880 KB
testcase_25 AC 1,515 ms
75,672 KB
testcase_26 AC 1,473 ms
75,768 KB
testcase_27 AC 1,549 ms
75,672 KB
testcase_28 AC 1,534 ms
75,768 KB
testcase_29 AC 1,524 ms
75,768 KB
testcase_30 AC 1,522 ms
75,768 KB
testcase_31 AC 1,518 ms
75,672 KB
testcase_32 AC 1,513 ms
75,672 KB
testcase_33 AC 1,488 ms
75,672 KB
testcase_34 AC 27 ms
10,176 KB
testcase_35 AC 26 ms
10,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
N=int(input())
A=[]
for i in range(N):
  x,y=map(int, input().split())
  A.append((x,y,i))
B=[]
for i in range(N-1):
  for j in range(i+1,N):
    ax,ay,an=A[i][0],A[i][1],A[i][2]
    bx,by,bn=A[j][0],A[j][1],A[j][2]
    d=(ax-bx)**2+(ay-by)**2
    B.append((d,an,bn))
B=sorted(B)
ans=0
D=[1]*N
for i in range(len(B)):
  na,nb=B[i][1],B[i][2]
  if D[na]==1 and D[nb]==1:
    if na==0:
      ans+=1
      D[nb]=0
    else:
      D[na]=0
      D[nb]=0
print(ans)
0