結果

問題 No.844 split game
ユーザー convexineqconvexineq
提出日時 2019-06-29 00:07:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 846 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 45,044 KB
最終ジャッジ日時 2023-09-14 22:49:47
合計ジャッジ時間 18,600 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 312 ms
22,484 KB
testcase_01 AC 367 ms
29,776 KB
testcase_02 AC 635 ms
34,096 KB
testcase_03 AC 539 ms
34,092 KB
testcase_04 AC 258 ms
20,176 KB
testcase_05 AC 706 ms
39,668 KB
testcase_06 AC 237 ms
19,600 KB
testcase_07 AC 281 ms
25,484 KB
testcase_08 AC 131 ms
15,060 KB
testcase_09 AC 470 ms
26,448 KB
testcase_10 AC 728 ms
38,916 KB
testcase_11 AC 777 ms
42,328 KB
testcase_12 AC 442 ms
25,652 KB
testcase_13 AC 282 ms
19,292 KB
testcase_14 AC 366 ms
26,676 KB
testcase_15 AC 830 ms
45,044 KB
testcase_16 AC 835 ms
44,908 KB
testcase_17 AC 815 ms
44,840 KB
testcase_18 AC 826 ms
44,948 KB
testcase_19 AC 845 ms
44,900 KB
testcase_20 AC 826 ms
44,948 KB
testcase_21 AC 840 ms
44,832 KB
testcase_22 AC 846 ms
44,900 KB
testcase_23 AC 41 ms
9,724 KB
testcase_24 AC 73 ms
11,480 KB
testcase_25 AC 42 ms
9,336 KB
testcase_26 AC 35 ms
9,556 KB
testcase_27 AC 54 ms
9,848 KB
testcase_28 AC 35 ms
9,696 KB
testcase_29 AC 67 ms
11,140 KB
testcase_30 AC 72 ms
11,308 KB
testcase_31 AC 56 ms
10,408 KB
testcase_32 AC 34 ms
9,524 KB
testcase_33 AC 70 ms
9,972 KB
testcase_34 AC 46 ms
9,312 KB
testcase_35 AC 82 ms
10,236 KB
testcase_36 AC 54 ms
9,436 KB
testcase_37 AC 119 ms
11,296 KB
testcase_38 AC 234 ms
16,788 KB
testcase_39 AC 508 ms
26,176 KB
testcase_40 AC 231 ms
20,688 KB
testcase_41 AC 16 ms
7,784 KB
testcase_42 AC 16 ms
7,892 KB
testcase_43 AC 16 ms
7,960 KB
testcase_44 AC 16 ms
7,840 KB
testcase_45 AC 17 ms
7,912 KB
testcase_46 AC 16 ms
7,860 KB
testcase_47 AC 17 ms
7,908 KB
testcase_48 AC 16 ms
7,888 KB
testcase_49 AC 16 ms
7,928 KB
testcase_50 AC 16 ms
7,916 KB
testcase_51 AC 16 ms
7,756 KB
testcase_52 AC 16 ms
7,788 KB
testcase_53 AC 16 ms
7,852 KB
testcase_54 AC 16 ms
7,920 KB
testcase_55 AC 16 ms
7,912 KB
testcase_56 AC 16 ms
7,820 KB
testcase_57 AC 16 ms
7,848 KB
testcase_58 AC 16 ms
7,844 KB
testcase_59 AC 16 ms
7,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

n,m,a = [int(i) for i in input().split()]
lrp = [[int(i) for i in input().split()] for _ in range(m)] + [[1,i,0] for i in range(1,n+1)]


lrp.sort(key = lambda x: x[1])

inf = 1e18
dp = [-inf]*(n+1)
dp[0] = 0

c = 0
for l,r,p in lrp:
    l-=1
    r-=1
    c = max(dp[r],c)
    if r != n-1:
        dp[r+1] = max(dp[r+1], dp[l]+p-a,c-a)
    else:
        dp[r+1] = max(dp[r+1], dp[l]+p,c-a)
        
#print(dp)

print(max(dp))
0