結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-22 22:30:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,301 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 151,100 KB
最終ジャッジ日時 2024-04-18 23:22:33
合計ジャッジ時間 30,125 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,864 KB
testcase_01 AC 38 ms
52,864 KB
testcase_02 AC 701 ms
113,384 KB
testcase_03 AC 983 ms
150,296 KB
testcase_04 AC 975 ms
149,844 KB
testcase_05 AC 793 ms
148,728 KB
testcase_06 AC 756 ms
148,468 KB
testcase_07 AC 195 ms
93,412 KB
testcase_08 AC 465 ms
143,716 KB
testcase_09 AC 136 ms
82,128 KB
testcase_10 AC 268 ms
105,900 KB
testcase_11 AC 209 ms
95,352 KB
testcase_12 AC 169 ms
88,632 KB
testcase_13 AC 899 ms
126,580 KB
testcase_14 AC 1,012 ms
134,104 KB
testcase_15 AC 1,206 ms
145,108 KB
testcase_16 AC 624 ms
109,424 KB
testcase_17 AC 1,267 ms
151,100 KB
testcase_18 AC 432 ms
99,092 KB
testcase_19 AC 1,163 ms
147,200 KB
testcase_20 AC 391 ms
95,136 KB
testcase_21 AC 484 ms
104,232 KB
testcase_22 AC 1,086 ms
139,736 KB
testcase_23 AC 78 ms
76,892 KB
testcase_24 AC 81 ms
77,020 KB
testcase_25 AC 179 ms
88,360 KB
testcase_26 AC 632 ms
113,620 KB
testcase_27 AC 645 ms
113,944 KB
testcase_28 AC 1,185 ms
140,328 KB
testcase_29 AC 230 ms
85,168 KB
testcase_30 AC 1,141 ms
144,192 KB
testcase_31 AC 779 ms
124,992 KB
testcase_32 AC 546 ms
108,116 KB
testcase_33 AC 1,301 ms
146,324 KB
testcase_34 AC 449 ms
99,892 KB
testcase_35 AC 1,143 ms
146,280 KB
testcase_36 AC 88 ms
77,316 KB
testcase_37 AC 137 ms
78,368 KB
testcase_38 AC 94 ms
77,380 KB
testcase_39 AC 128 ms
78,464 KB
testcase_40 AC 60 ms
67,660 KB
testcase_41 AC 1,231 ms
143,716 KB
testcase_42 AC 439 ms
97,876 KB
testcase_43 AC 646 ms
112,368 KB
testcase_44 AC 296 ms
90,444 KB
testcase_45 AC 667 ms
112,032 KB
testcase_46 AC 36 ms
53,512 KB
testcase_47 AC 36 ms
53,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush
n,m = map(int,input().split())
x,y = map(int,input().split())
x,y = x-1,y-1

PQ = [list(map(int,input().split())) for i in range(n)]
e = [[] for i in range(n)]
for _ in range(m):
    p,q = [int(i)-1 for i in input().split()]
    x1,y1 = PQ[p]
    x2,y2 = PQ[q]
    dis = ((x1-x2)**2+(y1-y2)**2)**0.5
    e[p].append((q,dis))
    e[q].append((p,dis))


inf = 10**10
dis = [inf]*n
dis[x] = 0
h = [[0,x]]
while h:
    d,now = heappop(h)
    if dis[now] != d:
        continue
    for nex,c in e[now]:
        if dis[nex] > d+c:
            dis[nex] = d+c
            heappush(h,[d+c,nex])

print(dis[y])
0