結果

問題 No.3198 Monotonic Query
コンテスト
ユーザー V_Melville
提出日時 2025-07-11 22:34:23
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 138 ms / 3,000 ms
+ 721µs
コード長 598 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,063 ms
コンパイル使用メモリ 375,848 KB
実行使用メモリ 9,348 KB
最終ジャッジ日時 2026-07-13 04:58:35
合計ジャッジ時間 9,054 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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