結果

問題 No.3424 Shooting Game
コンテスト
ユーザー i_taku
提出日時 2026-01-15 17:47:24
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 1,004 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,376 ms
コンパイル使用メモリ 227,664 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2026-01-15 17:47:30
合計ジャッジ時間 5,312 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 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 = 2 << 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);
    long long ans = 0LL;
    for (int i = 0; i < SIZE - T + 1; i++) {
        dp[i + T] = max(dp[i + T], dp[i] + seg.get(i));
        ans = max(ans, dp[i + T]);
    }
    cout << ans << endl;
}
0