結果

問題 No.1449 新プロランド
ユーザー あかりきあかりき
提出日時 2021-04-12 23:41:45
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 956 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 96,628 KB
最終ジャッジ日時 2023-08-25 16:53:04
合計ジャッジ時間 7,231 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
74,912 KB
testcase_01 AC 174 ms
78,528 KB
testcase_02 AC 201 ms
80,720 KB
testcase_03 AC 115 ms
78,284 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 290 ms
89,064 KB
testcase_07 AC 216 ms
86,944 KB
testcase_08 RE -
testcase_09 AC 311 ms
86,852 KB
testcase_10 RE -
testcase_11 AC 200 ms
87,156 KB
testcase_12 WA -
testcase_13 RE -
testcase_14 AC 181 ms
87,028 KB
testcase_15 WA -
testcase_16 AC 263 ms
86,624 KB
testcase_17 WA -
testcase_18 AC 89 ms
76,164 KB
testcase_19 AC 106 ms
81,816 KB
testcase_20 AC 80 ms
75,268 KB
testcase_21 AC 207 ms
87,836 KB
testcase_22 AC 173 ms
79,716 KB
testcase_23 AC 240 ms
90,696 KB
testcase_24 WA -
testcase_25 AC 96 ms
76,324 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
t=list(map(int,input().split()))

import heapq
def dijkstra_heap(s,list,n):
  edge=list
  d=[10**18]*n
  used=[True]*n 
  d[s]=0
  used[s]=False
  edgelist=[]
  for e in edge[s]:
    heapq.heappush(edgelist,e)
  while len(edgelist):
    minedge=heapq.heappop(edgelist)
    if not used[minedge[1]]:
      continue
    v=minedge[1]
    d[v]=minedge[0]
    used[v]=False
    for e in edge[v]:
      if used[e[1]]:
        heapq.heappush(edgelist,(e[0]+d[v],e[1]))
  return d

edge=[[] for i in range(n*1001)]
for i in range(m):
  for j in range(1001):
    edge[j*n+(l[i][0]-1)].append((t[l[i][0]-1]+l[i][2]//(j+t[l[i][0]-1]),min(j+t[l[i][0]-1],1000)*n+l[i][1]-1))
    edge[j*n+(l[i][1]-1)].append((t[l[i][1]-1]+l[i][2]//(j+t[l[i][0]-1]),min(j+t[l[i][0]-1],1000)*n+l[i][0]-1))

l=dijkstra_heap(0,edge,n*1001)
ans=[]
for i in range(1001):
  ans.append(l[i*n+n-1])
print(min(ans))
0