結果
| 問題 |
No.2804 Fixer And Ratism
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-17 20:51:25 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,016 bytes |
| コンパイル時間 | 4,101 ms |
| コンパイル使用メモリ | 296,740 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-11 23:09:59 |
| 合計ジャッジ時間 | 7,751 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 20 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main() {
int N, Q;
cin >> N >> Q;
//人を並べるための配列
vector<pair<int,string>> P;
//使用可能にしたかどうかを管理するmap
map<string,bool> mp;
for(int i = 0;i < Q; i++) {
int q;
cin >> q;
if(q == 1) {
string s;
int r;
cin >> s >> r;
mp[s] = false;
P.push_back({r, s});
}
if(q == 2) {
int x;
cin >> x;
N -= x;
}
if(q == 3) {
string s;
int x;
cin >> s >> x;
mp[s] = true;
N += x;
}
if((q == 1 || q == 2) && (int)P.size() > N) {
sort(P.begin(),P.end());
int j=0;
while((int)P.size() > N) {
if(mp[P[j].second] == true && P[j].first <= 4000) {
P.push_back({P[j].first + 5000, P[j].second});
P.erase(P.begin()+j);
}
else {
cout << P[j].second << endl;
P.erase(P.begin()+j);
}
sort(P.begin(),P.end());
}
}
}
}