結果
問題 |
No.3198 Monotonic Query
|
ユーザー |
|
提出日時 | 2025-07-11 22:21:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 66 ms / 3,000 ms |
コード長 | 916 bytes |
コンパイル時間 | 3,898 ms |
コンパイル使用メモリ | 251,412 KB |
実行使用メモリ | 8,832 KB |
最終ジャッジ日時 | 2025-07-12 10:55:01 |
合計ジャッジ時間 | 6,599 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template <class T> bool chmin(T& x, T y) { return x > y ? (x = y, true) : false; } template <class T> bool chmax(T& x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; #include <atcoder/all> // template atcoder segtree using S = ll; S op(S a, S b) { return max(a, b); } S e() { return -1e18; } using segtree = atcoder::segtree<S, op, e>; void solve() { int q; cin >> q; segtree seg(q); int sz = 0; rep(i, 0, q) { int t, x; cin >> t >> x; if (t == 1) { seg.set(sz, x); sz++; } else { cout << seg.prod(sz - x, sz) << "\n"; } } } int main() { int t = 1; // cin >> t; while (t--) solve(); }