結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

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

int main() {
    int q;
    cin >> q;
    
    segtree<int, op, e> t(q); int i = 0;
    rep(qi, q) {
        int type;
        cin >> type;
        
        if (type == 1) {
            int x;
            cin >> x;
            t.set(i++, x);
        }
        else {
            int k;
            cin >> k;
            cout << t.prod(i-k, i) << '\n';
        }
    }
    
    return 0;
}
0