結果
| 問題 |
No.1 道のショートカット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-09 11:06:29 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 625 bytes |
| コンパイル時間 | 120 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,520 KB |
| 最終ジャッジ日時 | 2024-07-01 13:56:12 |
| 合計ジャッジ時間 | 4,433 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 40 |
ソースコード
N = int(input())
C = int(input())
V = int(input())
S = list(map(lambda x: int(x)-1, input().split()))
T = list(map(lambda x: int(x)-1, input().split()))
Y = list(map(int, input().split()))
M = list(map(int, input().split()))
INF = 10**10
edge = [[] for _ in range(N)]
for s, t, y, m in zip(S, T, Y, M):
edge[s].append([t, y, m])
dp = [[INF]*(C+10) for _ in range(N+10)]
dp[0][0] = 0
for i in range(N-1):
for t, y, m in edge[i]:
for j in range(C+1):
if j+y > C:
break
dp[t][j+y] = min(dp[t][j+y], dp[i][j]+m)
if min(dp[N-1])==INF:
print(-1)
print(min(dp[N-1]))