結果

問題 No.3198 Monotonic Query
ユーザー ロロット
提出日時 2025-07-11 22:17:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 167 ms / 3,000 ms
コード長 790 bytes
コンパイル時間 6,092 ms
コンパイル使用メモリ 332,140 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-07-12 10:55:01
合計ジャッジ時間 10,446 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG // []で配列外参照をするとエラーにしてくれる。上下のやつがないとTLEになるので注意
#endif

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

using ll = long long;
using Graph = vector<vector<int>>;
ll INF = 2e18 + 1;

int op(int a, int b) { return max(a, b); }
int e() { return (int)(-1e9); }

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    segtree<int, op, e> seg(200010);
    int cur=0;
    int q; cin>>q;
    for(;q--;){
        int a,b;
        cin>>a>>b;
        if(a==1){seg.set(cur,b);cur++;}
        else{cout<<seg.prod(cur-b,cur)<<endl;}
    }
}
0