結果

問題 No.844 split game
ユーザー risujirohrisujiroh
提出日時 2019-06-28 22:42:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 662 bytes
コンパイル時間 1,562 ms
コンパイル使用メモリ 172,096 KB
実行使用メモリ 8,260 KB
最終ジャッジ日時 2023-09-14 22:25:40
合計ジャッジ時間 4,953 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
4,856 KB
testcase_01 AC 15 ms
6,616 KB
testcase_02 AC 34 ms
5,972 KB
testcase_03 AC 28 ms
6,804 KB
testcase_04 AC 14 ms
4,620 KB
testcase_05 AC 39 ms
7,216 KB
testcase_06 AC 13 ms
4,852 KB
testcase_07 WA -
testcase_08 AC 7 ms
4,380 KB
testcase_09 WA -
testcase_10 AC 41 ms
6,680 KB
testcase_11 AC 40 ms
7,816 KB
testcase_12 AC 26 ms
4,768 KB
testcase_13 WA -
testcase_14 AC 20 ms
5,964 KB
testcase_15 AC 44 ms
8,016 KB
testcase_16 AC 46 ms
8,064 KB
testcase_17 AC 46 ms
8,260 KB
testcase_18 AC 47 ms
8,028 KB
testcase_19 AC 47 ms
8,072 KB
testcase_20 WA -
testcase_21 AC 44 ms
8,108 KB
testcase_22 AC 43 ms
8,108 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 4 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 3 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 4 ms
4,376 KB
testcase_30 AC 4 ms
4,376 KB
testcase_31 AC 4 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 1 ms
4,380 KB
testcase_45 AC 1 ms
4,376 KB
testcase_46 AC 1 ms
4,380 KB
testcase_47 WA -
testcase_48 AC 1 ms
4,376 KB
testcase_49 AC 2 ms
4,376 KB
testcase_50 AC 2 ms
4,376 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 1 ms
4,376 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m, a; cin >> n >> m >> a;
  struct S { int l, p; };
  VV<S> d(n + 1);
  while (m--) {
    int l, r, p; cin >> l >> r >> p, --l;
    d[r].emplace_back(S{l, p});
  }
  V<lint> dp(n + 1, -1e18);
  dp[0] = 0;
  lint mx = 0;
  for (int i = 1; i <= n; ++i) {
    dp[i] = mx - a;
    for (S e : d[i]) {
      dp[i] = max(dp[i], dp[e.l] + e.p - a);
    }
    mx = max(mx, dp[i]);
  }
  cout << *max_element(begin(dp), end(dp)) << '\n';
}
0