結果
問題 |
No.1 道のショートカット
|
ユーザー |
![]() |
提出日時 | 2019-03-17 23:59:12 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 819 bytes |
コンパイル時間 | 188 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 376,224 KB |
最終ジャッジ日時 | 2024-07-08 05:10:03 |
合計ジャッジ時間 | 7,090 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 TLE * 1 -- * 32 |
ソースコード
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())) town = [[(None, None)] for i in range(N)] town[0] = [(0, 0)] for i in range(N): for v in range(V): if S[v]-1 == i: for t in town[i]: if t[0] is None: continue cost = t[0] + Y[v] if cost > C: continue time = t[1] + M[v] if town[T[v]-1][0] == (None, None): town[T[v]-1][0] = (cost, time) else: town[T[v]-1].append((cost, time)) ans = 1000 * N if town[N-1][0] == (None, None): ans = -1 else: for t in town[N-1]: if ans > t[1]: ans = t[1] print(ans)