結果

問題 No.844 split game
ユーザー mkawa2mkawa2
提出日時 2021-03-13 16:28:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 463 ms / 2,000 ms
コード長 973 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 36,224 KB
最終ジャッジ日時 2024-04-23 07:34:22
合計ジャッジ時間 11,281 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 187 ms
20,608 KB
testcase_01 AC 209 ms
25,728 KB
testcase_02 AC 345 ms
28,032 KB
testcase_03 AC 305 ms
28,672 KB
testcase_04 AC 149 ms
19,200 KB
testcase_05 AC 402 ms
32,512 KB
testcase_06 AC 145 ms
18,816 KB
testcase_07 AC 169 ms
22,528 KB
testcase_08 AC 91 ms
15,488 KB
testcase_09 AC 249 ms
22,528 KB
testcase_10 AC 411 ms
31,616 KB
testcase_11 AC 429 ms
34,432 KB
testcase_12 AC 245 ms
22,016 KB
testcase_13 AC 163 ms
18,176 KB
testcase_14 AC 211 ms
23,552 KB
testcase_15 AC 451 ms
36,096 KB
testcase_16 AC 451 ms
36,224 KB
testcase_17 AC 454 ms
36,224 KB
testcase_18 AC 457 ms
36,224 KB
testcase_19 AC 449 ms
36,096 KB
testcase_20 AC 463 ms
36,224 KB
testcase_21 AC 456 ms
36,096 KB
testcase_22 AC 444 ms
36,224 KB
testcase_23 AC 39 ms
11,776 KB
testcase_24 AC 56 ms
12,928 KB
testcase_25 AC 40 ms
11,520 KB
testcase_26 AC 36 ms
11,648 KB
testcase_27 AC 45 ms
11,904 KB
testcase_28 AC 36 ms
11,776 KB
testcase_29 AC 54 ms
12,800 KB
testcase_30 AC 59 ms
12,928 KB
testcase_31 AC 51 ms
12,160 KB
testcase_32 AC 36 ms
11,648 KB
testcase_33 AC 54 ms
12,032 KB
testcase_34 AC 43 ms
11,520 KB
testcase_35 AC 62 ms
12,288 KB
testcase_36 AC 46 ms
11,648 KB
testcase_37 AC 78 ms
13,056 KB
testcase_38 AC 142 ms
17,024 KB
testcase_39 AC 264 ms
20,992 KB
testcase_40 AC 137 ms
19,840 KB
testcase_41 AC 27 ms
10,880 KB
testcase_42 AC 26 ms
10,880 KB
testcase_43 AC 25 ms
10,752 KB
testcase_44 AC 26 ms
10,752 KB
testcase_45 AC 26 ms
10,880 KB
testcase_46 AC 26 ms
10,880 KB
testcase_47 AC 27 ms
10,752 KB
testcase_48 AC 27 ms
10,752 KB
testcase_49 AC 27 ms
10,880 KB
testcase_50 AC 28 ms
10,880 KB
testcase_51 AC 26 ms
11,008 KB
testcase_52 AC 27 ms
10,880 KB
testcase_53 AC 26 ms
10,880 KB
testcase_54 AC 28 ms
10,752 KB
testcase_55 AC 27 ms
10,880 KB
testcase_56 AC 26 ms
10,880 KB
testcase_57 AC 27 ms
10,880 KB
testcase_58 AC 25 ms
10,880 KB
testcase_59 AC 26 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**16
# md = 998244353
md = 10**9+7

n,m,a=LI()
frm=[[] for _ in range(n+1)]
for _ in range(m):
    l,r,p=LI()
    l-=1
    frm[r].append((l,p-a))

dp=[0]*(n+1)
mx=0
for r in range(1,n+1):
    dp[r]=mx-a
    for l,p in frm[r]:
        dp[r]=max(dp[r],dp[l]+p)
    mx=max(mx,dp[r])
dp[-1]+=a

print(dp[-1])
0