結果
問題 |
No.649 ここでちょっとQK!
|
ユーザー |
|
提出日時 | 2024-05-28 00:18:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 561 bytes |
コンパイル時間 | 2,271 ms |
コンパイル使用メモリ | 195,668 KB |
最終ジャッジ日時 | 2025-02-21 16:58:39 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 12 WA * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:13:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d%d", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:17:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d", &t); | ~~~~~^~~~~~~~~~ main.cpp:19:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d", &x); | ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h> typedef long long LL; const int N = 1e5 + 7; const int MOD = 998244353; int n, m, a[N], ans; std::multiset<int> big, small; int main() { scanf("%d%d", &n, &m); while(n--) { int t, x; scanf("%d", &t); if(t == 1) { scanf("%d", &x); small.insert(x); if(small.size() >= m) { big.insert(*small.rbegin()); small.erase(--small.end()); } } else { if(!big.empty()) { printf("%d\n", *big.begin()); big.erase(big.begin()); } else puts("-1"); } } return 0; }