結果
| 問題 |
No.649 ここでちょっとQK!
|
| コンテスト | |
| ユーザー |
squid
|
| 提出日時 | 2018-02-09 23:55:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 684 bytes |
| コンパイル時間 | 1,325 ms |
| コンパイル使用メモリ | 161,632 KB |
| 実行使用メモリ | 13,768 KB |
| 最終ジャッジ日時 | 2024-10-09 06:10:51 |
| 合計ジャッジ時間 | 9,165 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 16 TLE * 2 -- * 14 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
//constant
const long long int inf = 1<<30;
const int N = 1e5+1;
const int M = 1e5+1;
//variable
int q,k;
multiset<long long int> data;
//function
int main()
{
cin>>q>>k;
for(int i=0; i<q; i++){
int que;
cin>>que;
if(que==1){
long long int v;
cin>>v;
data.insert(v);
}
if(que==2){
if(data.size()<k){
cout<<-1<<endl;
continue;
}
auto it=data.begin();
for(int i=0; i<k-1; i++)it++;
cout<<*it<<endl;
data.erase(it);
}
}
return 0;
}
squid