結果

問題 No.3424 Shooting Game
コンテスト
ユーザー areik
提出日時 2026-01-11 14:42:20
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 968 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,843 ms
コンパイル使用メモリ 220,616 KB
実行使用メモリ 17,936 KB
最終ジャッジ日時 2026-01-11 17:22:21
合計ジャッジ時間 3,922 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/segtree.hpp>
#include <atcoder/lazysegtree.hpp>
#include <atcoder/modint.hpp>
using namespace std;

using i32 = int;
using i64 = long long;
using i128 = __int128_t;
using f64 = double;
using p2 = pair<i64, i64>;
using el = tuple<i64, i64, i64>;
using mint = atcoder::modint998244353;

void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  _main();
}

i64 op(i64 a, i64 b) {return max(a, b);}
i64 e() {return 0ll;}
void _main() {
  i64 n, T;
  cin >> n >> T;
  atcoder::lazy_segtree<i64, op, e, i64, op, op, e> seg(300000);
  for (i64 i = 0; i < n; i++) {
    i64 l, r, p;
    cin >> l >> r >> p;
    seg.apply(l, r + 1, p);
  }
  vector<i64> dp(300000, 0);
  i64 mx = 0;
  i64 ans = 0;
  for (i64 i = dp.size() - 1; i >= 0; i--) {
    if (i + T < dp.size()) mx = max(mx, dp[i + T]);
    dp[i] = mx + seg.get(i);
    ans = max(ans, dp[i]);
  }
  cout << ans << "\n";
}
0