結果
問題 | No.1 道のショートカット |
ユーザー | AAAR Salmon |
提出日時 | 2021-05-22 13:06:17 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 579 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 70,912 KB |
最終ジャッジ日時 | 2024-04-18 17:37:44 |
合計ジャッジ時間 | 4,289 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
52,352 KB |
testcase_01 | AC | 47 ms
52,352 KB |
testcase_02 | AC | 46 ms
52,736 KB |
testcase_03 | AC | 49 ms
52,864 KB |
testcase_04 | AC | 45 ms
52,096 KB |
testcase_05 | AC | 47 ms
52,480 KB |
testcase_06 | AC | 44 ms
52,480 KB |
testcase_07 | AC | 46 ms
52,736 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 60 ms
62,976 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 47 ms
52,480 KB |
testcase_16 | WA | - |
testcase_17 | AC | 42 ms
52,480 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 51 ms
59,136 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 43 ms
52,736 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 48 ms
54,144 KB |
testcase_36 | WA | - |
testcase_37 | AC | 55 ms
60,800 KB |
testcase_38 | AC | 43 ms
52,148 KB |
testcase_39 | WA | - |
testcase_40 | AC | 44 ms
53,592 KB |
testcase_41 | WA | - |
testcase_42 | AC | 43 ms
52,608 KB |
testcase_43 | AC | 41 ms
53,120 KB |
ソースコード
from heapq import heappop, heappush V = int(input()) C = int(input()) E = int(input()) edges = [[] for _ in range(V)] for s, t, y, m in zip(*(map(int,input().split()) for _ in range(4))): edges[s - 1].append((m, y, t - 1)) INF = 1 << 60 dp = [[INF] * (C + 1) for _ in range(V)] dp[0] = [0] * (C + 1) q = [(0, 0, 0)] while q: m, y, s = heappop(q) for dm, dy, t in edges[s]: if y + dy > C or m + dm >= dp[t][y + dy]: continue for ny in range(y + dy, C + 1): dp[t][ny] = m + dm heappush(q, (m + dm, y + dy, t)) print(dp[V - 1][C] if dp[V - 1][C] != INF else -1)