結果
問題 |
No.844 split game
|
ユーザー |
![]() |
提出日時 | 2019-07-07 20:34:42 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 438 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 82,000 KB |
実行使用メモリ | 95,116 KB |
最終ジャッジ日時 | 2024-10-05 09:13:41 |
合計ジャッジ時間 | 8,285 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 WA * 23 |
ソースコード
import collections n, m, a = map(int, input().split()) edge = collections.defaultdict(list) for _ in range(m): l, r, p = map(int, input().split()) edge[l - 1].append((r, p)) dp = [-a] * (n + 1) dp[0] = 0 for last in range(0, n + 1): for nxt, score in edge[last]: if nxt == n: dp[nxt] = max(dp[nxt], dp[last] + score) else: dp[nxt] = max(dp[nxt], dp[last] + score - a) print(max(dp))