結果

問題 No.3424 Shooting Game
コンテスト
ユーザー i_taku
提出日時 2026-01-15 17:54:53
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 946 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,501 ms
コンパイル使用メモリ 227,528 KB
実行使用メモリ 24,176 KB
最終ジャッジ日時 2026-01-15 17:54:58
合計ジャッジ時間 4,926 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

using S = long long;
using F = long long;

const S INF = 8e18;
const F ID = 8e18;

S op(S a, S b){ return std::max(a, b); }
S e(){ return 0; }
S mapping(F f, S x){ return (f == ID ? x : f); }
F composition(F f, F g){ return (f == ID ? g : f); }
F id(){ return ID; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, T; cin >> N >> T;
    vector<array<long long, 3>> PLR(N);
    for (auto& row : PLR) {
        cin >> row[1] >> row[2] >> row[0];
    }
    sort(PLR.begin(), PLR.end());
    const int SIZE = 4 << 17;
    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(SIZE);
    for (auto [p, l, r] : PLR) {
        seg.apply(l, r + 1, p);
    }
    vector<long long> dp(SIZE + 1, 0);
    for (int i = T; i <= SIZE; i++) {
        dp[i] = max(dp[i - T] + seg.get(i - T), dp[i - 1]);
    }
    cout << dp[SIZE] << endl;
}
0