結果
| 問題 |
No.649 ここでちょっとQK!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-24 20:45:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 587 bytes |
| コンパイル時間 | 1,009 ms |
| コンパイル使用メモリ | 70,272 KB |
| 実行使用メモリ | 13,600 KB |
| 最終ジャッジ日時 | 2024-06-25 03:15:20 |
| 合計ジャッジ時間 | 8,769 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 16 TLE * 2 -- * 14 |
ソースコード
#include <iostream>
#include <set>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
int Q,K;
cin>>Q>>K;
int type;
LL v;
int i;
multiset<LL> query;
multiset<LL>::iterator sit;
string s;
for (i=0;i<Q;i++){
cin>>type;
if (type==1){
cin>>v;
query.insert(multiset<LL>::value_type(v));
}else if (type==2){
int n=1;
if (query.size()>=K){
for (sit=query.begin();sit!=query.end();sit++,n++){
if (n==K){
cout<<*sit<<endl;
query.erase(sit);
break;
}
}
}else{
cout<<-1<<endl;
}
}
}
return 0;
}