結果

問題 No.844 split game
ユーザー ああいいああいい
提出日時 2022-01-01 23:14:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 636 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 36,096 KB
最終ジャッジ日時 2024-04-18 23:34:18
合計ジャッジ時間 14,835 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 256 ms
20,608 KB
testcase_01 AC 247 ms
25,472 KB
testcase_02 AC 503 ms
27,904 KB
testcase_03 AC 378 ms
28,288 KB
testcase_04 AC 201 ms
18,944 KB
testcase_05 AC 541 ms
32,384 KB
testcase_06 AC 182 ms
18,560 KB
testcase_07 AC 179 ms
22,400 KB
testcase_08 AC 108 ms
15,232 KB
testcase_09 AC 392 ms
22,400 KB
testcase_10 AC 580 ms
31,360 KB
testcase_11 AC 546 ms
34,304 KB
testcase_12 AC 365 ms
22,016 KB
testcase_13 AC 233 ms
17,920 KB
testcase_14 AC 257 ms
23,424 KB
testcase_15 AC 598 ms
35,968 KB
testcase_16 AC 586 ms
35,840 KB
testcase_17 AC 597 ms
35,840 KB
testcase_18 AC 607 ms
36,096 KB
testcase_19 AC 614 ms
35,968 KB
testcase_20 AC 592 ms
35,968 KB
testcase_21 AC 636 ms
35,968 KB
testcase_22 AC 585 ms
35,840 KB
testcase_23 AC 42 ms
11,520 KB
testcase_24 AC 71 ms
12,928 KB
testcase_25 AC 51 ms
11,264 KB
testcase_26 AC 39 ms
11,520 KB
testcase_27 AC 58 ms
11,520 KB
testcase_28 AC 35 ms
11,520 KB
testcase_29 AC 64 ms
12,416 KB
testcase_30 AC 63 ms
12,800 KB
testcase_31 AC 59 ms
12,032 KB
testcase_32 AC 37 ms
11,264 KB
testcase_33 AC 71 ms
11,904 KB
testcase_34 AC 58 ms
11,392 KB
testcase_35 AC 86 ms
12,160 KB
testcase_36 AC 59 ms
11,520 KB
testcase_37 AC 112 ms
13,056 KB
testcase_38 AC 203 ms
15,616 KB
testcase_39 AC 399 ms
20,608 KB
testcase_40 AC 158 ms
19,072 KB
testcase_41 AC 27 ms
10,624 KB
testcase_42 AC 28 ms
10,624 KB
testcase_43 AC 26 ms
10,624 KB
testcase_44 AC 28 ms
10,624 KB
testcase_45 AC 27 ms
10,752 KB
testcase_46 AC 28 ms
10,624 KB
testcase_47 AC 27 ms
10,752 KB
testcase_48 AC 28 ms
10,624 KB
testcase_49 AC 28 ms
10,752 KB
testcase_50 AC 29 ms
10,496 KB
testcase_51 AC 28 ms
10,752 KB
testcase_52 AC 27 ms
10,752 KB
testcase_53 AC 28 ms
10,752 KB
testcase_54 AC 29 ms
10,752 KB
testcase_55 AC 28 ms
10,624 KB
testcase_56 AC 26 ms
10,752 KB
testcase_57 AC 28 ms
10,624 KB
testcase_58 AC 25 ms
10,624 KB
testcase_59 AC 26 ms
10,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,A = map(int,input().split())

G = [[] for _ in range(N + 1)]
for _ in range(M):
    l,r,p = map(int,input().split())
    G[r].append((l,p))

dp = [0] * (N + 1)
_max = 0
index = 0
for i in range(1,N + 1):
    dp[i] = _max - A
    for l,p in G[i]:
        dp[i] = max(dp[i],dp[l-1] + p - A)
    if dp[i] > _max:
        _max = dp[i]
        index = i
dp[N] += A
print(max(dp))
    
    
0