結果

問題 No.844 split game
ユーザー hedwig100hedwig100
提出日時 2020-04-19 12:09:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 760 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 35,584 KB
最終ジャッジ日時 2024-04-15 08:11:56
合計ジャッジ時間 14,753 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 244 ms
19,840 KB
testcase_01 AC 233 ms
23,424 KB
testcase_02 AC 507 ms
27,136 KB
testcase_03 AC 390 ms
26,624 KB
testcase_04 AC 203 ms
18,304 KB
testcase_05 AC 542 ms
31,616 KB
testcase_06 AC 182 ms
18,432 KB
testcase_07 WA -
testcase_08 AC 105 ms
15,104 KB
testcase_09 WA -
testcase_10 AC 560 ms
30,976 KB
testcase_11 AC 568 ms
33,792 KB
testcase_12 AC 377 ms
22,144 KB
testcase_13 WA -
testcase_14 AC 270 ms
22,784 KB
testcase_15 AC 604 ms
33,920 KB
testcase_16 AC 608 ms
35,456 KB
testcase_17 AC 604 ms
35,456 KB
testcase_18 AC 594 ms
33,792 KB
testcase_19 AC 603 ms
34,688 KB
testcase_20 AC 594 ms
34,048 KB
testcase_21 AC 598 ms
35,456 KB
testcase_22 AC 605 ms
35,584 KB
testcase_23 AC 48 ms
11,648 KB
testcase_24 AC 70 ms
12,800 KB
testcase_25 AC 53 ms
11,520 KB
testcase_26 AC 42 ms
11,520 KB
testcase_27 AC 63 ms
11,776 KB
testcase_28 AC 40 ms
11,648 KB
testcase_29 AC 66 ms
12,416 KB
testcase_30 AC 70 ms
12,672 KB
testcase_31 AC 65 ms
12,032 KB
testcase_32 AC 40 ms
11,392 KB
testcase_33 AC 77 ms
12,032 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 206 ms
15,616 KB
testcase_39 AC 403 ms
21,120 KB
testcase_40 AC 163 ms
17,792 KB
testcase_41 AC 31 ms
10,752 KB
testcase_42 AC 31 ms
10,752 KB
testcase_43 AC 31 ms
10,752 KB
testcase_44 AC 31 ms
10,752 KB
testcase_45 AC 32 ms
10,752 KB
testcase_46 AC 31 ms
10,880 KB
testcase_47 AC 31 ms
10,752 KB
testcase_48 AC 31 ms
10,752 KB
testcase_49 AC 31 ms
10,752 KB
testcase_50 AC 30 ms
10,752 KB
testcase_51 WA -
testcase_52 AC 31 ms
10,752 KB
testcase_53 AC 31 ms
10,624 KB
testcase_54 AC 30 ms
10,752 KB
testcase_55 AC 30 ms
10,752 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 31 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 10 ** 9
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  collections import deque

def main():
    n,m,a = list(map(int,input().split()))
    kukann = [[] for i in range(n + 1)]
    for _ in range(m):
        l,r,p = map(int,input().split())
        l -= 1
        kukann[r].append((l,p))
    
    dp = [-a] * (n + 1)
    dp[0] = 0
    dp1 = [-a] * (n + 1)
    dp1[0] = 0
    for i in range(1,n):
        for l,p in kukann[i]:
            dp[i] = max(dp[i],dp[l] + p - a,dp1[l - 1] + p - 2 * a)
        dp1[i] = max(dp1[i - 1],dp[i])
    
    for l,p in kukann[n]:
        dp[n] = max(dp[n],dp[l] + p,dp[l - 1] + p - a)
    dp1[n] = max(dp1[n - 1],dp[n])

    print(max(dp1[-1],0))

if __name__ == '__main__':
    main()
0