結果

問題 No.844 split game
ユーザー shotoyooshotoyoo
提出日時 2021-09-02 23:23:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 1,061 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 92,404 KB
最終ジャッジ日時 2023-08-20 12:45:37
合計ジャッジ時間 12,345 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
82,804 KB
testcase_01 AC 151 ms
87,832 KB
testcase_02 AC 215 ms
84,916 KB
testcase_03 AC 186 ms
88,504 KB
testcase_04 AC 149 ms
81,980 KB
testcase_05 AC 231 ms
89,920 KB
testcase_06 AC 146 ms
82,320 KB
testcase_07 AC 136 ms
86,260 KB
testcase_08 AC 136 ms
80,204 KB
testcase_09 AC 172 ms
81,600 KB
testcase_10 AC 248 ms
88,548 KB
testcase_11 AC 231 ms
91,844 KB
testcase_12 AC 190 ms
81,216 KB
testcase_13 AC 141 ms
80,544 KB
testcase_14 AC 175 ms
86,224 KB
testcase_15 AC 239 ms
92,252 KB
testcase_16 AC 249 ms
92,404 KB
testcase_17 AC 241 ms
92,356 KB
testcase_18 AC 254 ms
92,240 KB
testcase_19 AC 241 ms
92,152 KB
testcase_20 AC 247 ms
92,236 KB
testcase_21 AC 244 ms
92,000 KB
testcase_22 AC 250 ms
92,204 KB
testcase_23 AC 101 ms
76,680 KB
testcase_24 AC 121 ms
78,892 KB
testcase_25 AC 97 ms
76,924 KB
testcase_26 AC 113 ms
76,936 KB
testcase_27 AC 103 ms
77,836 KB
testcase_28 AC 104 ms
76,664 KB
testcase_29 AC 112 ms
78,984 KB
testcase_30 AC 116 ms
78,636 KB
testcase_31 AC 105 ms
78,280 KB
testcase_32 AC 113 ms
76,876 KB
testcase_33 AC 98 ms
77,704 KB
testcase_34 AC 111 ms
76,856 KB
testcase_35 AC 107 ms
77,384 KB
testcase_36 AC 112 ms
77,696 KB
testcase_37 AC 105 ms
77,696 KB
testcase_38 AC 138 ms
79,016 KB
testcase_39 AC 173 ms
82,724 KB
testcase_40 AC 144 ms
83,660 KB
testcase_41 AC 76 ms
71,144 KB
testcase_42 AC 86 ms
71,516 KB
testcase_43 AC 77 ms
71,120 KB
testcase_44 AC 83 ms
71,364 KB
testcase_45 AC 76 ms
71,168 KB
testcase_46 AC 86 ms
71,268 KB
testcase_47 AC 79 ms
71,116 KB
testcase_48 AC 86 ms
71,204 KB
testcase_49 AC 78 ms
71,112 KB
testcase_50 AC 86 ms
71,232 KB
testcase_51 AC 77 ms
71,112 KB
testcase_52 AC 86 ms
71,360 KB
testcase_53 AC 75 ms
71,328 KB
testcase_54 AC 85 ms
71,240 KB
testcase_55 AC 76 ms
71,232 KB
testcase_56 AC 86 ms
71,356 KB
testcase_57 AC 76 ms
71,208 KB
testcase_58 AC 87 ms
71,112 KB
testcase_59 AC 78 ms
71,204 KB
権限があれば一括ダウンロードができます

ソースコード

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)
cum = 0
for i in range(1,n+1):
    val = cum
    for p,j in ns[i]:
        val = max(val, dp[j]+p)
    if i<n:
        val -= a
    dp[i] = val
    cum = max(cum, val)
ans = max(dp)
print(ans)
0