結果

問題 No.844 split game
ユーザー chocoruskchocorusk
提出日時 2019-06-28 21:44:05
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 908 bytes
コンパイル時間 807 ms
コンパイル使用メモリ 98,400 KB
実行使用メモリ 9,420 KB
最終ジャッジ日時 2023-09-14 21:46:08
合計ジャッジ時間 5,240 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
7,140 KB
testcase_01 AC 34 ms
7,308 KB
testcase_02 AC 88 ms
8,908 KB
testcase_03 AC 62 ms
8,000 KB
testcase_04 AC 34 ms
6,952 KB
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 AC 114 ms
9,112 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 109 ms
9,420 KB
testcase_19 AC 110 ms
9,108 KB
testcase_20 AC 114 ms
9,404 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 5 ms
5,864 KB
testcase_27 WA -
testcase_28 AC 4 ms
6,104 KB
testcase_29 AC 8 ms
5,964 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 4 ms
5,800 KB
testcase_33 AC 10 ms
6,120 KB
testcase_34 AC 8 ms
5,916 KB
testcase_35 AC 13 ms
6,204 KB
testcase_36 AC 9 ms
5,948 KB
testcase_37 AC 18 ms
6,632 KB
testcase_38 AC 31 ms
6,948 KB
testcase_39 AC 65 ms
8,272 KB
testcase_40 AC 21 ms
6,948 KB
testcase_41 AC 3 ms
6,072 KB
testcase_42 AC 4 ms
5,740 KB
testcase_43 AC 3 ms
6,076 KB
testcase_44 AC 3 ms
5,788 KB
testcase_45 AC 3 ms
6,120 KB
testcase_46 AC 3 ms
6,020 KB
testcase_47 AC 3 ms
5,724 KB
testcase_48 WA -
testcase_49 AC 3 ms
5,892 KB
testcase_50 AC 2 ms
5,916 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 3 ms
6,416 KB
testcase_54 AC 3 ms
6,016 KB
testcase_55 AC 3 ms
6,336 KB
testcase_56 AC 4 ms
5,724 KB
testcase_57 AC 3 ms
5,952 KB
testcase_58 AC 3 ms
5,828 KB
testcase_59 AC 3 ms
5,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;

int main()
{
    int n, m; ll a; cin>>n>>m>>a;
    ll dp[100010];
    fill(dp, dp+n+1, -a);
    dp[0]=0;
    vector<P> v[100010];
    for(int i=0; i<m; i++){
        int l, r; ll p; cin>>l>>r>>p;
        v[r].push_back({l, p});
    }
  ll ans=0;
    for(int i=1; i<=n; i++){
        for(auto p:v[i]){
            dp[i]=max(dp[i], dp[p.first-1]-a+p.second);
        }
      ans=max(dp[i], ans);
    }
  ans=max(ans, dp[n]+a);
    cout<<ans<<endl;
    return 0;
}
0