結果

問題 No.3198 Monotonic Query
ユーザー Ywestbuilderk
提出日時 2025-07-13 19:53:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 225 ms / 3,000 ms
コード長 370 bytes
コンパイル時間 3,178 ms
コンパイル使用メモリ 253,576 KB
実行使用メモリ 8,388 KB
最終ジャッジ日時 2025-07-13 19:53:41
合計ジャッジ時間 9,179 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
int op(int a,int b){
	return max(a,b);
}
int e(){
	return -1;
}
int main(){
	segtree<int,op,e> seg(3e5);
	int q;
	cin >> q;
	int i = 0;
	while(q--){
		int t,x;
		cin >> t >> x;
		if(t == 1){
			i++;
			seg.set(i,x);
		}
		else{
			cout << seg.prod(i-x+1,i + 1) << endl;
		}
	}
}
0