結果
| 問題 | 
                            No.1 道のショートカット
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kou
                         | 
                    
| 提出日時 | 2019-12-16 21:48:24 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 490 bytes | 
| コンパイル時間 | 73 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 17,948 KB | 
| 最終ジャッジ日時 | 2024-07-08 05:20:09 | 
| 合計ジャッジ時間 | 24,619 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 TLE * 2 -- * 19 | 
ソースコード
n, c, v, *L = map(int, open(0).read().split()) g = [[] for _ in range(n)] for s, t, y, m in zip(L, L[v:], L[2 * v:], L[3 * v:]): g[s - 1].append((t - 1, y, m)) dp = [[1 << 30] * (c + 1) for _ in range(n)] dp[0][c] = 0 q = [0] while q: cur = q.pop() for nxt, y, m in g[cur]: update=0 for i in range(y, c + 1): if dp[nxt][i - y] > dp[cur][i] + m: dp[nxt][i - y] = dp[cur][i] + m update=1 if update: q.append(nxt) ans = min(dp[-1]) print(ans if ans != 1 << 30 else -1)
            
kou