結果
| 問題 | No.649 ここでちょっとQK! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-28 00:18:21 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 561 bytes |
| 記録 | |
| コンパイル時間 | 1,319 ms |
| コンパイル使用メモリ | 213,212 KB |
| 実行使用メモリ | 13,312 KB |
| 最終ジャッジ日時 | 2026-07-04 19:23:45 |
| 合計ジャッジ時間 | 4,354 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 12 WA * 20 |
ソースコード
#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;
}