結果

問題 No.649 ここでちょっとQK!
ユーザー ohreitetsuohreitetsu
提出日時 2018-03-24 20:45:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 587 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 71,072 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2023-09-07 08:55:59
合計ジャッジ時間 10,995 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 244 ms
4,380 KB
testcase_04 AC 187 ms
12,744 KB
testcase_05 AC 187 ms
12,800 KB
testcase_06 AC 196 ms
12,760 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 106 ms
7,384 KB
testcase_13 AC 98 ms
7,384 KB
testcase_14 AC 94 ms
7,156 KB
testcase_15 AC 790 ms
7,112 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0