結果
| 問題 |
No.649 ここでちょっとQK!
|
| コンテスト | |
| ユーザー |
ts_
|
| 提出日時 | 2018-04-06 23:40:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 814 bytes |
| コンパイル時間 | 1,261 ms |
| コンパイル使用メモリ | 166,396 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 10:52:00 |
| 合計ジャッジ時間 | 5,573 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;
int main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int q,k;
ll v;
cin>>q>>k;
priority_queue<ll> pq1;
priority_queue<ll,vector<ll>,greater<ll> > pq2;
rep(i,q){
cin>>v;
if(v==1){
cin>>v;
if(pq1.size()<k-1) pq1.push(v);
else{
ll t=v;
if(!pq1.empty()&&pq1.top()>v) t=pq1.top(),pq1.pop(),pq1.push(v);
pq2.push(t);
}
}
if(v==2){
if(!pq2.empty()) cout<<pq2.top()<<endl,pq2.pop();
else cout<<-1<<endl;
}
}
return 0;
}
ts_