結果

問題 No.3198 Monotonic Query
ユーザー eve__fuyuki
提出日時 2025-07-12 19:52:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 59 ms / 3,000 ms
コード長 529 bytes
コンパイル時間 2,055 ms
コンパイル使用メモリ 195,244 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-07-12 19:52:56
合計ジャッジ時間 5,073 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void fast_io() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
}

#include <atcoder/segtree>
using namespace atcoder;
int op(int a, int b) { return max(a, b); }
int e() { return 0; }
int main() {
	fast_io();
	int q;
	cin >> q;
	segtree<int, op, e> seg(q);
	int cur = 0;
	for (; q--;) {
		int query;
		cin >> query;
		if (query == 1) {
			int x;
			cin >> x;
			seg.set(cur, x);
			cur++;
		} else {
			int k;
			cin >> k;
			cout << seg.prod(cur - k, cur) << "\n";
		}
	}
}
0