結果
| 問題 |
No.1 道のショートカット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-11 16:04:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 503 bytes |
| コンパイル時間 | 304 ms |
| コンパイル使用メモリ | 81,896 KB |
| 実行使用メモリ | 65,280 KB |
| 最終ジャッジ日時 | 2024-11-22 22:49:06 |
| 合計ジャッジ時間 | 3,903 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 WA * 26 |
ソースコード
import heapq
N = int(input())
C = int(input())
V = int(input())
S = list(map(int,input().split()))
T = list(map(int,input().split()))
Y = list(map(int,input().split()))
M = list(map(int,input().split()))
G=[[] for _ in range(N)]
for i in range(V):
G[S[i]-1].append((Y[i],M[i],T[i]-1))
hq=[(0,0,0)]
heapq.heapify(hq)
while(hq):
c,t,v=heapq.heappop(hq)
if v==N-1:
print(c)
exit()
for y,m,u in G[v]:
if c+y<=C:
heapq.heappush(hq,(t+m,c+y,u))
print(-1)