結果

問題 No.844 split game
ユーザー stngstng
提出日時 2022-07-16 17:03:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 734 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 97,908 KB
最終ジャッジ日時 2023-09-11 02:19:56
合計ジャッジ時間 16,678 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 202 ms
81,324 KB
testcase_02 WA -
testcase_03 AC 312 ms
84,532 KB
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 138 ms
78,052 KB
testcase_34 WA -
testcase_35 AC 146 ms
79,000 KB
testcase_36 AC 129 ms
78,016 KB
testcase_37 AC 170 ms
79,436 KB
testcase_38 AC 149 ms
81,128 KB
testcase_39 AC 207 ms
85,840 KB
testcase_40 AC 131 ms
80,140 KB
testcase_41 AC 73 ms
71,396 KB
testcase_42 AC 74 ms
71,344 KB
testcase_43 AC 73 ms
71,480 KB
testcase_44 AC 72 ms
71,224 KB
testcase_45 AC 72 ms
71,548 KB
testcase_46 AC 72 ms
71,216 KB
testcase_47 AC 71 ms
71,520 KB
testcase_48 WA -
testcase_49 AC 72 ms
71,356 KB
testcase_50 AC 72 ms
71,224 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 73 ms
71,088 KB
testcase_55 AC 73 ms
71,544 KB
testcase_56 AC 72 ms
71,308 KB
testcase_57 AC 72 ms
71,088 KB
testcase_58 AC 72 ms
71,556 KB
testcase_59 AC 74 ms
71,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,a = map(int,input().split())
lrp = [[int(i)-1 for i in input().split()] for j in range(m)]

lrp.sort()
dp = [[-10**15]*2 for i in range(n+1)]
dp[0][1] = 0
dp[n][1] = 0
for i in range(n):
    dp[i][0] = 0

for i in range(m):
    l,r,p = lrp[i]
    p += 1
    r += 1
    if l != 0:
        if r != n:
            dp[r][1] = max(0,dp[l][1]+p-a,dp[l][0]+p-2*a,dp[r][1])
        else:
            dp[r][1] = max(0,dp[l][1]+p,dp[l][0]+p-a,dp[r][1])
    else:
        if r != n:
            dp[r][1] = max(0,dp[l][1]+p-a,dp[l][0]+p-a,dp[r][1])
        else:
            dp[r][1] = max(0,dp[l][1]+p,dp[l][0]+p,dp[r][1])

ans = 0
#print(dp)
for i in range(n+1):
    ans = max(ans,dp[i][0],dp[i][1])

print(ans)
0