結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー titiatitia
提出日時 2020-05-29 21:47:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,161 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 147,988 KB
最終ジャッジ日時 2024-04-23 21:16:19
合計ジャッジ時間 27,594 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,608 KB
testcase_01 AC 44 ms
53,120 KB
testcase_02 AC 682 ms
112,472 KB
testcase_03 AC 909 ms
146,520 KB
testcase_04 AC 874 ms
146,384 KB
testcase_05 AC 636 ms
147,988 KB
testcase_06 AC 628 ms
147,520 KB
testcase_07 AC 217 ms
94,160 KB
testcase_08 AC 517 ms
142,144 KB
testcase_09 AC 150 ms
83,480 KB
testcase_10 AC 300 ms
106,752 KB
testcase_11 AC 237 ms
96,804 KB
testcase_12 AC 184 ms
88,744 KB
testcase_13 AC 894 ms
126,284 KB
testcase_14 AC 926 ms
130,440 KB
testcase_15 AC 1,142 ms
140,340 KB
testcase_16 AC 569 ms
106,396 KB
testcase_17 AC 1,102 ms
142,636 KB
testcase_18 AC 427 ms
97,788 KB
testcase_19 AC 1,097 ms
142,072 KB
testcase_20 AC 360 ms
94,428 KB
testcase_21 AC 480 ms
103,076 KB
testcase_22 AC 969 ms
134,756 KB
testcase_23 AC 78 ms
74,200 KB
testcase_24 AC 88 ms
77,696 KB
testcase_25 AC 172 ms
88,168 KB
testcase_26 AC 645 ms
113,104 KB
testcase_27 AC 610 ms
110,956 KB
testcase_28 AC 993 ms
133,992 KB
testcase_29 AC 223 ms
84,556 KB
testcase_30 AC 1,012 ms
139,856 KB
testcase_31 AC 713 ms
121,988 KB
testcase_32 AC 507 ms
105,648 KB
testcase_33 AC 1,030 ms
140,312 KB
testcase_34 AC 440 ms
99,872 KB
testcase_35 AC 1,112 ms
144,448 KB
testcase_36 AC 94 ms
77,096 KB
testcase_37 AC 137 ms
77,856 KB
testcase_38 AC 111 ms
77,184 KB
testcase_39 AC 135 ms
78,208 KB
testcase_40 AC 68 ms
67,584 KB
testcase_41 AC 1,161 ms
143,644 KB
testcase_42 AC 416 ms
97,996 KB
testcase_43 AC 664 ms
112,920 KB
testcase_44 AC 304 ms
90,152 KB
testcase_45 AC 626 ms
111,460 KB
testcase_46 AC 41 ms
53,968 KB
testcase_47 AC 41 ms
53,128 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