結果

問題 No.1449 新プロランド
ユーザー nasubi24nasubi24
提出日時 2021-03-31 15:49:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 579 ms / 2,000 ms
コード長 760 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 86,756 KB
実行使用メモリ 124,204 KB
最終ジャッジ日時 2023-08-25 16:49:37
合計ジャッジ時間 8,806 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
78,272 KB
testcase_01 AC 138 ms
80,356 KB
testcase_02 AC 172 ms
80,396 KB
testcase_03 AC 124 ms
79,136 KB
testcase_04 AC 126 ms
79,020 KB
testcase_05 AC 579 ms
124,204 KB
testcase_06 AC 359 ms
102,112 KB
testcase_07 AC 366 ms
108,360 KB
testcase_08 AC 321 ms
105,436 KB
testcase_09 AC 267 ms
85,884 KB
testcase_10 AC 436 ms
117,640 KB
testcase_11 AC 194 ms
96,904 KB
testcase_12 AC 315 ms
103,356 KB
testcase_13 AC 362 ms
93,768 KB
testcase_14 AC 192 ms
97,172 KB
testcase_15 AC 334 ms
101,704 KB
testcase_16 AC 261 ms
90,704 KB
testcase_17 AC 278 ms
96,348 KB
testcase_18 AC 113 ms
78,756 KB
testcase_19 AC 108 ms
87,432 KB
testcase_20 AC 109 ms
78,484 KB
testcase_21 AC 171 ms
90,772 KB
testcase_22 AC 150 ms
80,748 KB
testcase_23 AC 224 ms
98,256 KB
testcase_24 AC 298 ms
89,076 KB
testcase_25 AC 161 ms
83,180 KB
testcase_26 AC 130 ms
79,676 KB
testcase_27 AC 409 ms
113,080 KB
testcase_28 AC 277 ms
89,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m=map(int,input().split())
ans=[[10**10]*(12**4+100000//n) for _ in range(n)]
num=[[] for _ in range(n)]
for i in range(m):
    a,b,c=map(int,input().split())
    num[a-1].append([b-1,c])
    num[b-1].append([a-1,c])
t=list(map(int,input().split()))
ans[0][t[0]]=t[0]
queue=deque()
queue.append([0,t[0]])
seen=[False]*n
seen[0]=True
while len(queue)!=0:
    num1=queue.popleft()
    h1=num1[0]
    h2=num1[1]
    num2=num[h1]
    seen[h1]=True
    num3=ans[h1][h2]
    for i in range(len(num2)):
        j=num2[i][0]
        if h2+t[j]<12**4+100000//n:
       	    cnt=num3+num2[i][1]//h2+t[j]
            if ans[j][h2+t[j]]>cnt:
                ans[j][h2+t[j]]=cnt
                queue.append([j,h2+t[j]])
print(min(ans[-1]))
0