結果
| 問題 |
No.844 split game
|
| コンテスト | |
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2019-07-07 20:11:02 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 401 bytes |
| コンパイル時間 | 319 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 998,124 KB |
| 最終ジャッジ日時 | 2024-10-05 08:14:27 |
| 合計ジャッジ時間 | 7,701 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | MLE * 1 -- * 55 |
ソースコード
import collections
n, m, a = map(int, input().split())
d = collections.defaultdict(int)
for _ in range(m):
l, r, p = map(int, input().split())
d[(l - 1, r)] = p
dp = [-float('inf')] * (n + 1)
dp[0] = 0
for last in range(0, n + 1):
for nxt in range(last + 1, n):
dp[nxt] = max(dp[nxt], dp[last] + d[(last, nxt)] - a)
dp[n] = max(dp[n], dp[last] + d[(last, n)])
print(max(dp))
neko_the_shadow