結果
| 問題 | No.649 ここでちょっとQK! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-10 00:58:20 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 475 bytes |
| 記録 | |
| コンパイル時間 | 711 ms |
| コンパイル使用メモリ | 59,376 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-06 21:44:49 |
| 合計ジャッジ時間 | 21,104 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 12 WA * 18 TLE * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:42: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type’ {aka ‘long long int’} [-Wformat=]
23 | printf("%d\n",v[K-1]);
| ~^
| |
| int
| %lld
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d%d",&Q,&K);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d",&q);
| ~~~~~^~~~~~~~~
main.cpp:16:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | scanf("%lld",&n);
| ~~~~~^~~~~~~~~~~
ソースコード
#pragma GCC optimize("O3")
#pragma GCC target("arch=corei7-avx")
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
vector<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("%d\n",v[K-1]);
v.erase(v.begin()+K-1);
}
}
}
}