結果

問題 No.844 split game
ユーザー Coki628Coki628
提出日時 2020-08-14 15:56:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,169 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 82,584 KB
実行使用メモリ 87,992 KB
最終ジャッジ日時 2024-04-18 18:40:22
合計ジャッジ時間 7,877 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
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 53 ms
71,952 KB
testcase_34 WA -
testcase_35 AC 59 ms
73,524 KB
testcase_36 AC 50 ms
70,860 KB
testcase_37 AC 61 ms
77,064 KB
testcase_38 AC 77 ms
77,744 KB
testcase_39 AC 112 ms
81,460 KB
testcase_40 AC 75 ms
80,524 KB
testcase_41 WA -
testcase_42 AC 34 ms
52,328 KB
testcase_43 AC 34 ms
52,468 KB
testcase_44 AC 34 ms
52,756 KB
testcase_45 WA -
testcase_46 AC 33 ms
53,128 KB
testcase_47 WA -
testcase_48 AC 37 ms
53,060 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 34 ms
53,024 KB
testcase_56 AC 36 ms
53,200 KB
testcase_57 AC 36 ms
52,988 KB
testcase_58 AC 36 ms
53,400 KB
testcase_59 AC 34 ms
53,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N, M, K = MAP()

RL = [[] for i in range(N+1)]
for i in range(M):
    l, r, p = MAP()
    l -= 1
    RL[r].append((l, p))

dp0 = [0] * (N+1)
dp1 = [0] * (N+1)
for r in range(1, N+1):
    dp0[r] = max(dp0[r-1], dp1[r-1])
    for l, p in RL[r]:
        if r == N:
            dp1[r] = max(dp1[r], dp0[l] + p-K)
            dp1[r] = max(dp1[r], dp1[l] + p)
        else:
            dp1[r] = max(dp1[r], dp0[l] + p-K*2)
            dp1[r] = max(dp1[r], dp1[l] + p-K)
ans = max(dp0[N], dp1[N])
print(ans)
0