結果

問題 No.844 split game
ユーザー shotoyoo
提出日時 2021-09-02 23:20:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 539 bytes
コンパイル時間 2,179 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 91,648 KB
最終ジャッジ日時 2024-11-30 14:29:40
合計ジャッジ時間 9,600 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


n,m,a = list(map(int, input().split()))
ns = [[(0,0)] for _ in range(n+1)]
for _ in range(m):
    l,r,p = list(map(int, input().split()))
    l -= 1
    ns[r].append((p,l))
dp = [0]*(n+1)
for i in range(1,n+1):
    val = 0
    for p,j in ns[i]:
        val = max(val, dp[j]+p)
    if i<n:
        val -= a
    dp[i] = val
ans = max(dp)
print(ans)
0