結果

問題 No.649 ここでちょっとQK!
ユーザー cielciel
提出日時 2018-02-10 01:01:47
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,412 ms / 3,000 ms
コード長 410 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 65,320 KB
実行使用メモリ 5,504 KB
最終ジャッジ日時 2024-04-17 15:11:14
合計ジャッジ時間 20,968 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 23 ms
5,376 KB
testcase_04 AC 62 ms
5,376 KB
testcase_05 AC 67 ms
5,376 KB
testcase_06 AC 63 ms
5,504 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 453 ms
5,376 KB
testcase_13 AC 438 ms
5,376 KB
testcase_14 AC 426 ms
5,376 KB
testcase_15 AC 520 ms
5,376 KB
testcase_16 AC 555 ms
5,376 KB
testcase_17 AC 676 ms
5,376 KB
testcase_18 AC 851 ms
5,376 KB
testcase_19 AC 976 ms
5,376 KB
testcase_20 AC 1,178 ms
5,376 KB
testcase_21 AC 1,326 ms
5,376 KB
testcase_22 AC 1,532 ms
5,376 KB
testcase_23 AC 1,726 ms
5,376 KB
testcase_24 AC 1,938 ms
5,376 KB
testcase_25 AC 2,195 ms
5,376 KB
testcase_26 AC 2,412 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 452 ms
5,376 KB
testcase_31 AC 548 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 1 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <deque>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	deque<long long>v;
	int Q,K,q;
	long long n;
	scanf("%d%d",&Q,&K);
	for(;Q--;){
		scanf("%d",&q);
		if(q==1){
			scanf("%lld",&n);
			auto it=lower_bound(v.begin(),v.end(),n);
			v.insert(it,n);
		}else{
			if(v.size()<K){
				puts("-1");
			}else{
				printf("%lld\n",v[K-1]);
				v.erase(v.begin()+K-1);
			}
		}
	}
}
0