結果

問題 No.844 split game
ユーザー AEnAEn
提出日時 2022-12-05 23:22:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 339 ms / 2,000 ms
コード長 410 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 93,440 KB
最終ジャッジ日時 2024-04-20 21:22:42
合計ジャッジ時間 11,427 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
82,176 KB
testcase_01 AC 161 ms
84,736 KB
testcase_02 AC 260 ms
88,448 KB
testcase_03 AC 219 ms
87,488 KB
testcase_04 AC 148 ms
81,964 KB
testcase_05 AC 281 ms
90,752 KB
testcase_06 AC 144 ms
81,792 KB
testcase_07 AC 133 ms
80,640 KB
testcase_08 AC 126 ms
78,720 KB
testcase_09 AC 222 ms
83,456 KB
testcase_10 AC 305 ms
89,472 KB
testcase_11 AC 302 ms
91,520 KB
testcase_12 AC 196 ms
83,584 KB
testcase_13 AC 164 ms
80,640 KB
testcase_14 AC 175 ms
84,192 KB
testcase_15 AC 293 ms
91,520 KB
testcase_16 AC 300 ms
91,520 KB
testcase_17 AC 314 ms
91,904 KB
testcase_18 AC 289 ms
91,520 KB
testcase_19 AC 339 ms
93,440 KB
testcase_20 AC 293 ms
91,804 KB
testcase_21 AC 307 ms
92,032 KB
testcase_22 AC 307 ms
91,924 KB
testcase_23 AC 112 ms
77,056 KB
testcase_24 AC 114 ms
77,804 KB
testcase_25 AC 109 ms
77,056 KB
testcase_26 AC 86 ms
74,240 KB
testcase_27 AC 117 ms
77,312 KB
testcase_28 AC 79 ms
67,200 KB
testcase_29 AC 110 ms
77,872 KB
testcase_30 AC 119 ms
77,568 KB
testcase_31 AC 101 ms
77,056 KB
testcase_32 AC 97 ms
72,576 KB
testcase_33 AC 106 ms
76,800 KB
testcase_34 AC 83 ms
73,984 KB
testcase_35 AC 107 ms
77,312 KB
testcase_36 AC 97 ms
76,928 KB
testcase_37 AC 117 ms
77,312 KB
testcase_38 AC 144 ms
80,128 KB
testcase_39 AC 234 ms
84,480 KB
testcase_40 AC 124 ms
79,872 KB
testcase_41 AC 48 ms
51,968 KB
testcase_42 AC 48 ms
52,096 KB
testcase_43 AC 48 ms
51,968 KB
testcase_44 AC 48 ms
52,096 KB
testcase_45 AC 49 ms
52,096 KB
testcase_46 AC 50 ms
52,224 KB
testcase_47 AC 51 ms
51,712 KB
testcase_48 AC 49 ms
52,096 KB
testcase_49 AC 49 ms
51,968 KB
testcase_50 AC 48 ms
52,096 KB
testcase_51 AC 48 ms
51,968 KB
testcase_52 AC 48 ms
51,712 KB
testcase_53 AC 48 ms
51,968 KB
testcase_54 AC 49 ms
51,968 KB
testcase_55 AC 51 ms
52,480 KB
testcase_56 AC 48 ms
52,224 KB
testcase_57 AC 49 ms
52,096 KB
testcase_58 AC 49 ms
51,712 KB
testcase_59 AC 51 ms
51,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, A = map(int, input().split())
G = [list() for _ in range(N+1)]
for i in range(M):
    l,r,p = map(int, input().split())
    l-=1
    G[r].append([l,p])
dp = [-A]*(N+1)
dp[0] = 0
res = 0
for i in range(1,N):
    for l, p in G[i]:
        dp[i] = max(dp[i],dp[l]+p-A)
    res = max(res,dp[i])
    dp[i] = max(dp[i],res-A)
for l, p in G[-1]:
    dp[-1] = max(dp[-1],dp[l]+p)
res = max(res,dp[-1])
print(res)
0