結果
問題 | No.649 ここでちょっとQK! |
ユーザー |
|
提出日時 | 2019-01-03 03:31:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2,811 ms / 3,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 776 ms |
コンパイル使用メモリ | 67,284 KB |
最終ジャッジ日時 | 2025-01-06 20:08:57 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d%d",&Q,&K); | ~~~~~^~~~~~~~~~~~~~ main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d",&q); | ~~~~~^~~~~~~~~ main.cpp:15:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%lld",&n); | ~~~~~^~~~~~~~~~~
ソースコード
#pragma GCC optimize("O3")#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);}}}}