結果

問題 No.844 split game
ユーザー neterukunneterukun
提出日時 2019-06-28 23:13:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 659 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 34,972 KB
最終ジャッジ日時 2023-09-14 22:40:28
合計ジャッジ時間 12,095 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 157 ms
17,820 KB
testcase_02 WA -
testcase_03 AC 290 ms
24,496 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 123 ms
15,816 KB
testcase_07 AC 113 ms
15,812 KB
testcase_08 RE -
testcase_09 AC 315 ms
27,052 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 306 ms
26,832 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 RE -
testcase_16 WA -
testcase_17 AC 498 ms
34,972 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 507 ms
34,704 KB
testcase_22 AC 495 ms
34,732 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 AC 39 ms
10,180 KB
testcase_28 RE -
testcase_29 WA -
testcase_30 AC 46 ms
10,432 KB
testcase_31 WA -
testcase_32 RE -
testcase_33 AC 49 ms
10,420 KB
testcase_34 WA -
testcase_35 AC 56 ms
10,948 KB
testcase_36 AC 38 ms
9,896 KB
testcase_37 AC 78 ms
12,288 KB
testcase_38 AC 153 ms
17,292 KB
testcase_39 AC 342 ms
26,708 KB
testcase_40 AC 108 ms
13,872 KB
testcase_41 AC 17 ms
7,856 KB
testcase_42 AC 17 ms
7,784 KB
testcase_43 RE -
testcase_44 AC 17 ms
7,864 KB
testcase_45 AC 17 ms
7,816 KB
testcase_46 RE -
testcase_47 AC 16 ms
7,864 KB
testcase_48 AC 16 ms
8,012 KB
testcase_49 RE -
testcase_50 RE -
testcase_51 AC 16 ms
7,780 KB
testcase_52 AC 17 ms
7,812 KB
testcase_53 WA -
testcase_54 RE -
testcase_55 AC 16 ms
8,248 KB
testcase_56 AC 17 ms
7,960 KB
testcase_57 AC 17 ms
7,928 KB
testcase_58 AC 17 ms
7,736 KB
testcase_59 AC 16 ms
8,324 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))

dp = [0]*(n+1)
end = 0
max_dp = 0
for i in range(1, n + 1):
    if info[end][1] == i:
        while end < m and info[end][1] == i:
            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
        max_dp = max(max_dp, dp[i])
    else:
        dp[i] = max_dp - a
print(max(dp))
0