結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー paruf4paruf4
提出日時 2020-05-29 22:37:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 694 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 119,040 KB
最終ジャッジ日時 2024-04-23 23:54:28
合計ジャッジ時間 29,346 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
16,512 KB
testcase_01 AC 27 ms
11,008 KB
testcase_02 AC 1,453 ms
62,080 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 AC 1,882 ms
97,724 KB
testcase_06 AC 1,840 ms
97,724 KB
testcase_07 AC 472 ms
38,272 KB
testcase_08 AC 1,847 ms
114,048 KB
testcase_09 AC 170 ms
19,840 KB
testcase_10 AC 790 ms
56,960 KB
testcase_11 AC 541 ms
42,240 KB
testcase_12 AC 567 ms
34,560 KB
testcase_13 AC 1,870 ms
73,856 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,187 ms
53,632 KB
testcase_17 TLE -
testcase_18 AC 814 ms
42,112 KB
testcase_19 TLE -
testcase_20 AC 577 ms
34,688 KB
testcase_21 AC 1,151 ms
49,024 KB
testcase_22 TLE -
testcase_23 AC 47 ms
11,904 KB
testcase_24 AC 52 ms
12,288 KB
testcase_25 AC 501 ms
31,872 KB
testcase_26 AC 1,285 ms
57,088 KB
testcase_27 AC 1,350 ms
59,136 KB
testcase_28 TLE -
testcase_29 AC 278 ms
22,272 KB
testcase_30 TLE -
testcase_31 AC 1,575 ms
70,528 KB
testcase_32 AC 969 ms
50,816 KB
testcase_33 TLE -
testcase_34 AC 891 ms
43,520 KB
testcase_35 TLE -
testcase_36 AC 42 ms
11,392 KB
testcase_37 AC 47 ms
12,032 KB
testcase_38 AC 40 ms
11,520 KB
testcase_39 AC 46 ms
11,904 KB
testcase_40 AC 34 ms
11,008 KB
testcase_41 TLE -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop,heappush
def dijkstra(s,n,edge):
  dist=[float("inf")]*n
  dist[s]=0
  used=[-1]*n
  hq=[[dist[s],s]]
  while hq:
    d,cur=heappop(hq)
    if dist[cur]<d:continue 
    for nx,nxd in edge[cur]:
      if dist[cur]+nxd<dist[nx]:
        dist[nx]=dist[cur]+nxd
        used[nx]=cur
        heappush(hq,[dist[cur]+nxd,nx])
  return dist

n,m=map(int,input().split())
x,y=map(int,input().split())
pq=[tuple(map(int,input().split())) for i in range(n)]
G=[[] for i in range(n)]
for i in range(m):
  p,q=map(int,input().split())
  p-=1
  q-=1
  c=((pq[q][0]-pq[p][0])**2+(pq[q][1]-pq[p][1])**2)**0.5
  G[p].append([q,c])
  G[q].append([p,c])
d=dijkstra(x-1,n,G)
print(d[y-1])
0