結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,880 KB
testcase_01 AC 26 ms
10,880 KB
testcase_02 AC 1,178 ms
61,184 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 AC 1,656 ms
95,648 KB
testcase_06 AC 1,643 ms
95,772 KB
testcase_07 AC 470 ms
37,760 KB
testcase_08 AC 1,746 ms
112,640 KB
testcase_09 AC 187 ms
19,712 KB
testcase_10 AC 836 ms
56,192 KB
testcase_11 AC 550 ms
41,856 KB
testcase_12 AC 540 ms
34,432 KB
testcase_13 AC 1,920 ms
74,496 KB
testcase_14 AC 1,789 ms
81,280 KB
testcase_15 TLE -
testcase_16 AC 1,241 ms
52,352 KB
testcase_17 TLE -
testcase_18 AC 858 ms
40,960 KB
testcase_19 TLE -
testcase_20 AC 556 ms
34,048 KB
testcase_21 AC 1,143 ms
48,128 KB
testcase_22 AC 1,936 ms
85,888 KB
testcase_23 AC 49 ms
11,776 KB
testcase_24 AC 55 ms
12,032 KB
testcase_25 AC 480 ms
31,872 KB
testcase_26 AC 1,217 ms
56,320 KB
testcase_27 AC 1,150 ms
57,984 KB
testcase_28 TLE -
testcase_29 AC 300 ms
22,144 KB
testcase_30 AC 1,949 ms
91,776 KB
testcase_31 AC 1,259 ms
68,740 KB
testcase_32 AC 839 ms
49,664 KB
testcase_33 AC 1,881 ms
92,544 KB
testcase_34 AC 817 ms
42,496 KB
testcase_35 TLE -
testcase_36 AC 41 ms
11,392 KB
testcase_37 AC 49 ms
11,776 KB
testcase_38 AC 43 ms
11,520 KB
testcase_39 AC 46 ms
11,904 KB
testcase_40 AC 32 ms
11,136 KB
testcase_41 TLE -
testcase_42 AC 689 ms
41,984 KB
testcase_43 AC 1,269 ms
64,384 KB
testcase_44 AC 424 ms
30,464 KB
testcase_45 AC 1,190 ms
63,104 KB
testcase_46 AC 27 ms
11,008 KB
testcase_47 AC 26 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
X,Y=map(int,input().split())
L=[tuple(map(int,input().split())) for i in range(N)]
E=[[] for i in range(N+1)]

from math import sqrt

for i in range(M):
    p,q=map(int,input().split())
    p-=1
    q-=1
    x0,y0=L[p]
    x1,y1=L[q]
    E[p].append((sqrt((x0-x1)**2+(y0-y1)**2),q))
    E[q].append((sqrt((x0-x1)**2+(y0-y1)**2),p))

import heapq
DP=[1<<62]*(N+1)
DP[X-1]=0

Q=[(0,X-1)]

while Q:
    now,x=heapq.heappop(Q)

    for le,to in E[x]:
        if DP[to]>DP[x]+le:
            DP[to]=DP[x]+le
            heapq.heappush(Q,(DP[to]+le,to))
print(DP[Y-1])
    
    
    
    
0