結果
| 問題 | No.2804 Fixer And Ratism |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-12-15 00:22:14 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 940 bytes |
| 記録 | |
| コンパイル時間 | 3,118 ms |
| コンパイル使用メモリ | 292,352 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-12-15 00:22:21 |
| 合計ジャッジ時間 | 6,915 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, q;
cin >> n >> q;
map<string, int> name2rate;
map<int, string> rate2name;
set<int> fixed, nfixed;
while (q--) {
int t;
cin >> t;
if (t == 1) {
string s;
int r;
cin >> s >> r;
rate2name[r] = s;
name2rate[s] = r;
nfixed.insert(r);
}
if (t == 2) {
int x;
cin >> x;
n -= x;
}
if (t == 3) {
string s;
int x;
cin >> s >> x;
fixed.insert(name2rate[s]);
nfixed.erase(name2rate[s]);
n += x;
}
while (fixed.size() + nfixed.size() > n) {
auto& rem = (!nfixed.empty() ? nfixed : fixed);
int r = *rem.begin();
rem.erase(r);
cout << rate2name[r] << '\n';
}
}
return 0;
}
a01sa01to