結果

問題 No.3198 Monotonic Query
ユーザー tau1235
提出日時 2025-07-11 21:31:01
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 401 bytes
コンパイル時間 3,106 ms
コンパイル使用メモリ 280,408 KB
実行使用メモリ 13,240 KB
最終ジャッジ日時 2025-07-11 21:31:22
合計ジャッジ時間 9,247 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int q;
  cin>>q;
  multiset<int> st;
  vector<int> a;
  int j=0;
  for (int i=0;i<q;i++){
    int t;
    cin>>t;
    if (t==1){
      int x;
      cin>>x;
      a.push_back(x);
      st.insert(x);
    }
    if (t==2){
      int k;
      cin>>k;
      while (st.size()>k) st.erase(st.find(a[j++]));
      cout<<*st.rbegin()<<endl;
    }
  }
}
0