結果

問題 No.1449 新プロランド
ユーザー nasubi24nasubi24
提出日時 2021-03-31 15:37:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 704 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 79,068 KB
最終ジャッジ日時 2023-08-25 16:49:08
合計ジャッジ時間 4,665 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
76,368 KB
testcase_01 AC 96 ms
76,780 KB
testcase_02 AC 116 ms
78,260 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 116 ms
78,536 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 116 ms
78,412 KB
testcase_10 AC 114 ms
78,464 KB
testcase_11 AC 117 ms
78,508 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 99 ms
76,920 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 96 ms
76,340 KB
testcase_19 AC 99 ms
76,972 KB
testcase_20 AC 96 ms
76,360 KB
testcase_21 AC 112 ms
78,544 KB
testcase_22 AC 103 ms
78,132 KB
testcase_23 AC 113 ms
78,624 KB
testcase_24 AC 127 ms
78,824 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

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+t[j]<=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