結果

問題 No.1265 Balloon Survival
ユーザー tyawanmusityawanmusi
提出日時 2020-10-23 22:52:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,727 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 827 ms
コンパイル使用メモリ 86,772 KB
実行使用メモリ 142,868 KB
最終ジャッジ日時 2023-09-28 17:23:23
合計ジャッジ時間 22,890 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,404 KB
testcase_01 AC 75 ms
71,424 KB
testcase_02 AC 76 ms
71,476 KB
testcase_03 AC 78 ms
71,252 KB
testcase_04 AC 77 ms
71,296 KB
testcase_05 AC 78 ms
71,248 KB
testcase_06 AC 78 ms
71,208 KB
testcase_07 AC 76 ms
71,172 KB
testcase_08 AC 76 ms
71,256 KB
testcase_09 AC 76 ms
71,552 KB
testcase_10 AC 77 ms
71,404 KB
testcase_11 AC 78 ms
71,428 KB
testcase_12 AC 78 ms
71,212 KB
testcase_13 AC 77 ms
71,080 KB
testcase_14 AC 212 ms
83,360 KB
testcase_15 AC 170 ms
82,744 KB
testcase_16 AC 106 ms
76,664 KB
testcase_17 AC 827 ms
110,180 KB
testcase_18 AC 132 ms
80,568 KB
testcase_19 AC 111 ms
76,848 KB
testcase_20 AC 212 ms
83,516 KB
testcase_21 AC 411 ms
94,576 KB
testcase_22 AC 269 ms
88,332 KB
testcase_23 AC 290 ms
89,464 KB
testcase_24 AC 1,727 ms
141,224 KB
testcase_25 AC 1,723 ms
142,120 KB
testcase_26 AC 1,708 ms
142,868 KB
testcase_27 AC 1,712 ms
142,116 KB
testcase_28 AC 1,712 ms
142,484 KB
testcase_29 AC 1,718 ms
142,596 KB
testcase_30 AC 1,705 ms
142,544 KB
testcase_31 AC 1,683 ms
142,192 KB
testcase_32 AC 1,715 ms
142,024 KB
testcase_33 AC 1,713 ms
142,120 KB
testcase_34 AC 76 ms
71,544 KB
testcase_35 AC 76 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda:sys.stdin.readline().rstrip()

n=int(input())
xy=[tuple(map(int,input().split()))for _ in range(n)]
e=[]
for i in range(n-1):
  for j in range(i+1,n):
    x1,y1=xy[i]
    x2,y2=xy[j]
    e.append(((x1-x2)**2+(y1-y2)**2)*1000000+i*1000+j)
e.sort()
used=[0]*n
ans=0
for x in e:
  _,x=divmod(x,1000000)
  i,j=divmod(x,1000)
  if used[i]+used[j]:
    continue
  if i==0:
    used[j]=1
    ans+=1
  else:
    used[i]=used[j]=1
print(ans)
0