結果

問題 No.844 split game
ユーザー neko_the_shadow
提出日時 2019-07-07 18:27:13
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 360 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 93,064 KB
最終ジャッジ日時 2024-10-05 03:34:22
合計ジャッジ時間 9,468 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other RE * 25 TLE * 1 -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def f(current):
    ans = d[(current, n)] # 線を引かない場合
    for nxt in range(current + 1, n):
        ans = max(ans, f(nxt) + d[(current, nxt)] - a)
    return ans

print(f(0))
0