結果

問題 No.3198 Monotonic Query
ユーザー takoyaki782
提出日時 2025-07-14 18:19:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 276 ms / 3,000 ms
コード長 960 bytes
コンパイル時間 4,334 ms
コンパイル使用メモリ 253,400 KB
実行使用メモリ 8,908 KB
最終ジャッジ日時 2025-07-14 18:20:03
合計ジャッジ時間 12,189 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll inf_ll = 9223372036854775807;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using mint = atcoder::modint998244353;
using mint1 = atcoder::modint1000000007;
using Pa = std::pair<ll, ll>;

int Yes(bool x){
    if(x) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}

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

int main(){
    ll Q;
    cin >> Q;
    segtree<ll, op, e> S(Q);
    ll N = 0;
    rep(i, Q){
        ll a, b;
        cin >> a >> b;
        if(a == 1){
            S.set(N, b);
            N++;
        }
        else{
            cout << S.prod(N-b, N) << endl;
        }
    }
}
0