結果

問題 No.1449 新プロランド
ユーザー nasubi24nasubi24
提出日時 2021-03-31 15:38:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 699 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 78,988 KB
最終ジャッジ日時 2023-08-25 16:49:10
合計ジャッジ時間 4,599 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
76,600 KB
testcase_01 AC 94 ms
76,800 KB
testcase_02 AC 112 ms
78,464 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 118 ms
78,476 KB
testcase_07 AC 105 ms
78,932 KB
testcase_08 WA -
testcase_09 AC 115 ms
78,396 KB
testcase_10 AC 113 ms
78,448 KB
testcase_11 AC 113 ms
78,552 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 97 ms
77,156 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 95 ms
76,544 KB
testcase_19 AC 94 ms
77,300 KB
testcase_20 AC 95 ms
76,520 KB
testcase_21 AC 109 ms
78,988 KB
testcase_22 AC 99 ms
78,164 KB
testcase_23 AC 111 ms
78,404 KB
testcase_24 AC 122 ms
78,612 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 124 ms
78,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m=map(int,input().split())
ans=[[10**10]*(11**4+200) 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]])
while len(queue)!=0:
    num1=queue.popleft()
    h1=num1[0]
    h2=num1[1]
    num2=num[h1]
    num3=ans[h1][h2]
    for i in range(len(num2)):
        j=num2[i][0]
        if h2<=num2[i][1]:
       	    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