結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー takakintakakin
提出日時 2020-06-03 23:58:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 868 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 114,048 KB
最終ジャッジ日時 2024-05-04 20:08:38
合計ジャッジ時間 22,835 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,880 KB
testcase_01 AC 34 ms
10,880 KB
testcase_02 AC 1,312 ms
62,080 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 AC 1,606 ms
101,376 KB
testcase_06 AC 1,662 ms
101,376 KB
testcase_07 AC 362 ms
38,016 KB
testcase_08 AC 1,413 ms
114,048 KB
testcase_09 AC 133 ms
19,712 KB
testcase_10 AC 597 ms
56,832 KB
testcase_11 AC 406 ms
42,496 KB
testcase_12 AC 695 ms
42,624 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,411 ms
59,648 KB
testcase_17 TLE -
testcase_18 AC 995 ms
48,768 KB
testcase_19 TLE -
testcase_20 AC 538 ms
35,328 KB
testcase_21 AC 1,403 ms
58,496 KB
testcase_22 TLE -
testcase_23 AC 50 ms
12,032 KB
testcase_24 AC 55 ms
12,544 KB
testcase_25 AC 628 ms
39,040 KB
testcase_26 AC 1,195 ms
59,700 KB
testcase_27 AC 1,404 ms
63,232 KB
testcase_28 TLE -
testcase_29 AC 322 ms
25,472 KB
testcase_30 TLE -
testcase_31 AC 1,479 ms
69,684 KB
testcase_32 AC 920 ms
51,712 KB
testcase_33 TLE -
testcase_34 AC 960 ms
48,000 KB
testcase_35 TLE -
testcase_36 AC 41 ms
11,520 KB
testcase_37 AC 46 ms
11,904 KB
testcase_38 AC 42 ms
11,520 KB
testcase_39 AC 46 ms
11,776 KB
testcase_40 AC 35 ms
11,264 KB
testcase_41 TLE -
testcase_42 AC 666 ms
42,624 KB
testcase_43 AC 1,303 ms
65,536 KB
testcase_44 AC 393 ms
30,848 KB
testcase_45 AC 1,266 ms
63,744 KB
testcase_46 AC 32 ms
10,880 KB
testcase_47 AC 32 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,m=map(int,input().split())
x,y=map(int,input().split())
PQ=[tuple(int(i) for i in input().split()) for _ in range(n)]

def f(A,B):
  a1,a2=A
  b1,b2=B
  return ((a1-b1)**2+(a2-b2)**2)**0.5

edge=[[] for i in range(n)]
for _ in range(m):
  p,q=map(int,input().split())
  dis=f(PQ[p-1],PQ[q-1])
  edge[p-1].append([dis,q-1])
  edge[q-1].append([dis,p-1])

import heapq
def dijkstra_heap(s):
  d=[float("inf")]*n
  used=[True]*n
  d[s]=0
  used[s]=False
  edgelist=[]
  for e in edge[s]:
    heapq.heappush(edgelist,e)
  while edgelist:
    minedge = heapq.heappop(edgelist)
    if not used[minedge[1]]:
      continue
    v = minedge[1]
    d[v] = minedge[0]
    used[v] = False
    for e in edge[v]:
      if used[e[1]]:
        heapq.heappush(edgelist,[e[0]+d[v],e[1]])
  return d
print(dijkstra_heap(x-1)[y-1])
0