結果

問題 No.3424 Shooting Game
コンテスト
ユーザー i_taku
提出日時 2026-01-16 14:07:39
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 668 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,428 ms
コンパイル使用メモリ 220,476 KB
実行使用メモリ 17,584 KB
最終ジャッジ日時 2026-01-16 14:07:44
合計ジャッジ時間 4,025 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

constexpr int SIZE = 2 << 17;
long long dp[SIZE];
vector<pair<int, int>> PR[SIZE];
priority_queue<pair<int, int>> pq;

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

    int N, T;
    cin >> N >> T;
    while (N--) {
        int l, r, p;
        cin >> l >> r >> p;
        PR[l].emplace_back(p, r);
    }

    pq.push({0, SIZE});
    for (int i = 1; i < SIZE; i++) {
        for (auto [p, r] : PR[i]) {
            pq.push({p, r});
        }
        while (pq.top().second < i) pq.pop();
        dp[i] = max(dp[i - 1], dp[max(0, i - T)] + pq.top().first);
    }
    cout << dp[SIZE - 1] << endl;
}
0