結果

問題 No.844 split game
ユーザー neterukunneterukun
提出日時 2019-06-28 22:31:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 686 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 94,464 KB
最終ジャッジ日時 2023-09-14 22:19:13
合計ジャッジ時間 12,078 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 149 ms
82,168 KB
testcase_02 WA -
testcase_03 AC 210 ms
85,488 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 106 ms
78,576 KB
testcase_34 WA -
testcase_35 AC 110 ms
78,440 KB
testcase_36 AC 100 ms
78,736 KB
testcase_37 AC 121 ms
79,176 KB
testcase_38 AC 154 ms
82,012 KB
testcase_39 AC 251 ms
88,800 KB
testcase_40 AC 129 ms
79,624 KB
testcase_41 AC 76 ms
71,476 KB
testcase_42 AC 75 ms
71,672 KB
testcase_43 AC 75 ms
71,376 KB
testcase_44 AC 76 ms
71,532 KB
testcase_45 AC 76 ms
71,608 KB
testcase_46 AC 76 ms
71,432 KB
testcase_47 AC 78 ms
71,328 KB
testcase_48 WA -
testcase_49 AC 76 ms
71,284 KB
testcase_50 AC 77 ms
71,488 KB
testcase_51 AC 77 ms
71,656 KB
testcase_52 AC 75 ms
71,536 KB
testcase_53 WA -
testcase_54 AC 77 ms
71,388 KB
testcase_55 AC 76 ms
71,460 KB
testcase_56 AC 75 ms
71,336 KB
testcase_57 AC 74 ms
71,488 KB
testcase_58 AC 74 ms
71,388 KB
testcase_59 AC 77 ms
71,332 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:
            if i == n:
                dp[i] = max(dp[i], dp[info[end][0] - 1] + info[end][2])
            else:
                dp[i] = max(dp[i], 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