結果

問題 No.3198 Monotonic Query
ユーザー 北杜
提出日時 2025-07-11 21:52:02
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 250 ms / 3,000 ms
コード長 822 bytes
コンパイル時間 6,029 ms
コンパイル使用メモリ 335,068 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-07-12 10:53:50
合計ジャッジ時間 11,837 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define rep(i, n) for (int i = 0; i < (ll)(n); i++)
#define all(a) (a).begin(), (a).end()
using ll = long long;
const int INF32 = 2e9;
const ll INF64 = 4e18;

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

void printYN(bool ok){
    if(ok)cout << "Yes" << endl;
    else cout << "No" << endl;
    return;
}

int main() {
    int now = 0, Q;
    cin >> Q;
    segtree<int, op, e> seg(Q);
    rep(i, Q){
        int type;
        cin >> type;
        if(type==1){
            int x;
            cin >> x;
            seg.set(now, x);
            now++;
        } else{
            int k;
            cin >> k;
            cout << seg.prod(now-k,now) << endl;
        }
    }
    return 0;
}
0