結果

問題 No.844 split game
ユーザー neterukunneterukun
提出日時 2019-06-28 22:48:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 1,037 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 92,752 KB
最終ジャッジ日時 2023-09-14 22:29:14
合計ジャッジ時間 13,154 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 152 ms
81,968 KB
testcase_02 WA -
testcase_03 AC 212 ms
85,264 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 153 ms
81,284 KB
testcase_07 AC 130 ms
79,604 KB
testcase_08 WA -
testcase_09 AC 235 ms
87,000 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 228 ms
87,312 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 292 ms
91,032 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 302 ms
91,584 KB
testcase_22 AC 295 ms
91,384 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 104 ms
78,452 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 122 ms
79,296 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 110 ms
78,432 KB
testcase_34 WA -
testcase_35 AC 108 ms
78,332 KB
testcase_36 AC 103 ms
78,396 KB
testcase_37 AC 124 ms
78,984 KB
testcase_38 AC 161 ms
81,936 KB
testcase_39 AC 243 ms
88,836 KB
testcase_40 AC 132 ms
79,536 KB
testcase_41 AC 78 ms
71,276 KB
testcase_42 AC 80 ms
71,596 KB
testcase_43 AC 78 ms
71,516 KB
testcase_44 AC 78 ms
71,440 KB
testcase_45 AC 77 ms
71,340 KB
testcase_46 AC 78 ms
71,516 KB
testcase_47 AC 77 ms
71,108 KB
testcase_48 AC 76 ms
71,424 KB
testcase_49 AC 79 ms
71,616 KB
testcase_50 AC 76 ms
71,252 KB
testcase_51 AC 79 ms
71,284 KB
testcase_52 AC 79 ms
71,420 KB
testcase_53 WA -
testcase_54 AC 77 ms
71,428 KB
testcase_55 AC 76 ms
71,244 KB
testcase_56 AC 78 ms
71,384 KB
testcase_57 AC 78 ms
71,256 KB
testcase_58 AC 79 ms
71,324 KB
testcase_59 AC 77 ms
71,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter


input = sys.stdin.readline
n, m, a = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]

info = sorted(info, key = itemgetter(1)) + [[-1, -1, -1]] # 番兵

dp = [0]*(n+1)
end = 0
max_dp = 0
for i in range(1, n + 1):
    if info[end][1] == i:
        while True:
            #print(end, info[end][0], info[end][1])
            #print(max_dp)
            if i == n:
                dp[i] = max(dp[i], max_dp, dp[info[end][0] - 1] + info[end][2])
            else:
                dp[i] = max(dp[i], max_dp - a, dp[info[end][0] - 1] + info[end][2] - a)
            end += 1
            if info[end][1] != i:
                break
        max_dp = max(max_dp, dp[i])
    else:
        dp[i] = max_dp - a
print(max(dp))
0