結果

問題 No.3198 Monotonic Query
ユーザー ルク
提出日時 2025-07-11 21:28:23
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 248 ms / 3,000 ms
コード長 545 bytes
コンパイル時間 4,897 ms
コンパイル使用メモリ 211,152 KB
実行使用メモリ 8,836 KB
最終ジャッジ日時 2025-07-12 10:50:11
合計ジャッジ時間 11,089 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/segtree>
using namespace std;
using namespace atcoder;

long long op(long long a, long long b) {
    return max(a, b);
}

long long e() {
    return -1e18;
}

int main() {
    int q;
    cin >> q;
    segtree<long long, op, e> seg(q);
    int cnt = 0;

    for (int i = 0; i < q; ++i) {
        int t;
        long long x;
        cin >> t >> x;

        if (t == 1) {
            seg.set(cnt++, x);
        } else {
            cout << seg.prod(cnt - x, cnt) << '\n';
        }
    }

    return 0;
}
0