結果
問題 | No.844 split game |
ユーザー |
|
提出日時 | 2021-02-22 08:35:49 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 700 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 212 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 36,096 KB |
最終ジャッジ日時 | 2024-09-20 05:22:07 |
合計ジャッジ時間 | 16,954 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 56 |
ソースコード
N, M, A = map(int, input().split()) sections = [[] for _ in range(N)] for _ in range(M): l, r, p = map(int, input().split()) l -= 1 sections[l].append((r, p)) dp = [-10 ** 9 - 5] * (N + 1) dp[0] = 0 cur_max = 0 for i, s in enumerate(sections): dp[i] = max(dp[i], cur_max - A) cur = dp[i] for r, p in s: dp[r] = max(dp[r], cur + p - (A if r != N else 0)) cur_max = max(cur_max, cur) print(max(dp))