結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー ttrttr
提出日時 2020-05-29 21:44:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 852 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 114,048 KB
最終ジャッジ日時 2024-04-23 21:04:23
合計ジャッジ時間 55,895 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,880 KB
testcase_01 AC 33 ms
10,880 KB
testcase_02 AC 1,295 ms
62,208 KB
testcase_03 TLE -
testcase_04 AC 1,969 ms
104,704 KB
testcase_05 AC 1,640 ms
97,152 KB
testcase_06 AC 1,708 ms
97,152 KB
testcase_07 AC 446 ms
38,144 KB
testcase_08 AC 1,743 ms
114,048 KB
testcase_09 AC 161 ms
19,712 KB
testcase_10 AC 782 ms
56,704 KB
testcase_11 AC 533 ms
42,240 KB
testcase_12 AC 762 ms
38,528 KB
testcase_13 AC 1,850 ms
73,856 KB
testcase_14 AC 1,933 ms
82,304 KB
testcase_15 TLE -
testcase_16 AC 1,372 ms
55,168 KB
testcase_17 TLE -
testcase_18 AC 1,003 ms
44,928 KB
testcase_19 TLE -
testcase_20 AC 601 ms
34,304 KB
testcase_21 AC 1,265 ms
53,376 KB
testcase_22 TLE -
testcase_23 AC 59 ms
11,904 KB
testcase_24 AC 64 ms
12,160 KB
testcase_25 AC 662 ms
35,328 KB
testcase_26 AC 1,238 ms
57,472 KB
testcase_27 AC 1,342 ms
59,264 KB
testcase_28 TLE -
testcase_29 AC 334 ms
23,808 KB
testcase_30 TLE -
testcase_31 AC 1,461 ms
67,756 KB
testcase_32 AC 937 ms
50,048 KB
testcase_33 TLE -
testcase_34 AC 943 ms
44,928 KB
testcase_35 TLE -
testcase_36 AC 44 ms
11,520 KB
testcase_37 AC 50 ms
11,776 KB
testcase_38 AC 46 ms
11,520 KB
testcase_39 AC 50 ms
11,904 KB
testcase_40 AC 38 ms
11,136 KB
testcase_41 TLE -
testcase_42 AC 769 ms
42,368 KB
testcase_43 AC 1,365 ms
65,408 KB
testcase_44 AC 494 ms
30,848 KB
testcase_45 AC 1,291 ms
63,872 KB
testcase_46 AC 28 ms
10,880 KB
testcase_47 AC 32 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
N,M = map(int, input().split())
X,Y = map(int, input().split())
L = [[int(l) for l in input().split()] for _ in range(N)]
E = [[] for _ in range(N)]
for _ in range(M):
    p,q = map(int, input().split())
    p -= 1
    q -= 1
    d = ((L[p][0]-L[q][0])**2 + (L[p][1]-L[q][1])**2)**0.5
    E[p].append((q, d))
    E[q].append((p, d))

def dijkstra(s):
    used = [0]*N
    inf = 10**12
    d = [inf]*N
    used[s] = 1
    d[s] = 0
    h = []
    for e in E[s]:
        heapq.heappush(h, (e[1], e[0]))
    while h:
        temp = heapq.heappop(h)
        u = temp[1]
        r = temp[0]
        if used[u] == 1:
            continue
        d[u] = r
        used[u] = 1
        for e in E[u]:
            if used[e[0]] == 1:
                continue
            heapq.heappush(h, (r+e[1], e[0]))
    return d

d = dijkstra(X-1)
print(d[Y-1])
0