結果

問題 No.3198 Monotonic Query
ユーザー srjywrdnprkt
提出日時 2025-07-25 14:18:47
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 180 ms / 3,000 ms
コード長 590 bytes
コンパイル時間 3,120 ms
コンパイル使用メモリ 279,016 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-07-25 14:18:57
合計ジャッジ時間 9,226 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/segtree>

using namespace std;
using namespace atcoder;
using ll = long long;
//using mint = modint998244353;

int op(int a, int b){return max(a, b);};
int e(){return 0;};

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

    int Q, now=0;
    cin >> Q;
    segtree<int, op, e> tree(Q);

    while(Q--){
        int t, x;
        cin >> t >> x;
        if (t == 1){
            tree.set(now, x);
            now++;
        }
        else{
            cout << tree.prod(now-x, now) << endl;
        }
    }

    return 0;
}
0