結果

問題 No.844 split game
ユーザー sinsincoscossinsincoscos
提出日時 2019-03-13 22:37:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 619 bytes
コンパイル時間 1,794 ms
コンパイル使用メモリ 72,608 KB
実行使用メモリ 6,428 KB
最終ジャッジ日時 2023-09-06 20:45:50
合計ジャッジ時間 5,879 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 6 ms
5,352 KB
testcase_24 AC 10 ms
5,680 KB
testcase_25 AC 6 ms
5,292 KB
testcase_26 AC 4 ms
5,184 KB
testcase_27 AC 8 ms
5,760 KB
testcase_28 AC 4 ms
5,152 KB
testcase_29 AC 7 ms
5,656 KB
testcase_30 AC 8 ms
5,636 KB
testcase_31 AC 8 ms
5,820 KB
testcase_32 AC 3 ms
5,352 KB
testcase_33 AC 10 ms
5,620 KB
testcase_34 AC 7 ms
5,680 KB
testcase_35 AC 12 ms
6,000 KB
testcase_36 AC 8 ms
5,628 KB
testcase_37 AC 16 ms
6,084 KB
testcase_38 AC 29 ms
6,428 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 AC 3 ms
5,304 KB
testcase_42 AC 3 ms
5,420 KB
testcase_43 AC 3 ms
5,352 KB
testcase_44 AC 3 ms
5,220 KB
testcase_45 AC 3 ms
5,360 KB
testcase_46 AC 3 ms
5,152 KB
testcase_47 AC 3 ms
5,160 KB
testcase_48 AC 3 ms
5,340 KB
testcase_49 AC 2 ms
5,412 KB
testcase_50 AC 3 ms
5,296 KB
testcase_51 AC 2 ms
5,148 KB
testcase_52 AC 3 ms
5,204 KB
testcase_53 AC 3 ms
5,184 KB
testcase_54 AC 3 ms
5,300 KB
testcase_55 AC 2 ms
5,436 KB
testcase_56 AC 3 ms
5,124 KB
testcase_57 AC 2 ms
5,300 KB
testcase_58 AC 3 ms
5,292 KB
testcase_59 AC 3 ms
5,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,ll> P;
int N,M;
ll A,dp[100010] = {};
vector<vector<P>> v(100010);

int main(){
    cin >> N >> M >> A;
    assert(N<=10000 && M<=100000);
    int l,r;
    ll p;
    for(int i=0;i<M;i++){
        cin >> l >> r >> p;
        assert(l<=r);
        v[r].push_back(P(l,p));
    }
    ll ma = 0;
    for(int i=1;i<=N;i++){
        dp[i] = ma-A;
        for(auto x:v[i]){
            dp[i] = max(dp[i],dp[x.first-1]+x.second-(i==N? 0:A));
        }
        ma = max(ma,dp[i]);
    }
    cout << ma << endl;
}
0