結果
問題 |
No.649 ここでちょっとQK!
|
ユーザー |
![]() |
提出日時 | 2018-02-09 23:00:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,776 bytes |
コンパイル時間 | 1,300 ms |
コンパイル使用メモリ | 127,488 KB |
最終ジャッジ日時 | 2025-01-05 08:15:12 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 WA * 19 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <cstring> #include <queue> #include <stack> #include <math.h> #include <iterator> #include <vector> #include <string> #include <set> #include <math.h> #include <iostream> #include<map> #include <iomanip> #include <time.h> #include <stdlib.h> #include <list> #include <typeinfo> #include <list> #include <set> #include <cassert> #include<fstream> #include <cstdlib> #define EVAL 1 using namespace std; #define Ma_PI 3.141592653589793 #define eps 0.00000001 #define LONG_INF 3000000000000000000 #define GOLD 1.61803398874989484820458 #define MAX_MOD 1000000007 #define REP(i,n) for(long long i = 0;i < n;++i) #define seg_size 524288 #define PI 3.1415926535 using namespace std; int main(){ #define int long long iostream::sync_with_stdio(false); int query,k; cin >> query >> k; set<long long> over_k; set<long long> under_k; map<long long,long long> over_wow,under_wow; long long now_mew = 0; REP(i,query){ long long a; cin >> a; if(a == 1){ cin >> a; if(now_mew+1LL < k){ under_k.insert(a); under_wow[a]++; now_mew++; }else{ now_mew++; auto hoge = under_k.end(); if(k == 1) goto foo; hoge--; if(*hoge <= a){ foo:; over_wow[a]++; over_k.insert(a); }else{ under_k.insert(a); under_wow[*hoge]--; if(under_wow[*hoge] == 0){ under_k.erase(*hoge); } over_k.insert(*hoge); over_wow[*hoge]++; } } }else{ if(now_mew >= k){ now_mew--; auto hoge = over_k.begin(); cout << *hoge << endl; over_wow[*hoge]--; if(over_wow[*hoge] == 0){ over_k.erase(*hoge); } }else{ cout << -1 << endl; } } } return 0; }