結果
| 問題 | No.3198 Monotonic Query |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-12 10:35:54 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 3,000 ms |
| + 982µs | |
| コード長 | 493 bytes |
| 記録 | |
| コンパイル時間 | 1,160 ms |
| コンパイル使用メモリ | 217,736 KB |
| 実行使用メモリ | 8,960 KB |
| 最終ジャッジ日時 | 2026-07-13 05:01:18 |
| 合計ジャッジ時間 | 3,988 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int N = 2000086, MOD = 998244353, INF = 0x3f3f3f3f;
ll res;
int n, m, cnt, w[N];
int main() {
cin >> m;
set<pii> st;
while (m--) {
int op, a;
scanf("%d%d", &op, &a);
if (op == 1) {
w[++n] = a;
while (st.size() && st.rbegin()->second <= w[n]) st.erase(*st.rbegin());
st.insert({n, a});
} else printf("%d\n", st.lower_bound({n - a + 1, -INF})->second);
}
return 0;
}