結果
問題 |
No.2804 Fixer And Ratism
|
ユーザー |
|
提出日時 | 2024-04-30 21:13:06 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,009 bytes |
コンパイル時間 | 3,775 ms |
コンパイル使用メモリ | 291,108 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-11 23:09:46 |
合計ジャッジ時間 | 8,024 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main() { int N, Q; cin >> N >> Q; //人を並べるためのpriority_queue priority_queue<pair<int,string>, vector<pair<int,string>>, greater<pair<int,string>>> que; //使用可能にしたかどうかを管理する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; que.push({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)que.size() > N) { while((int)que.size() > N) { if(mp[que.top().second] == true && que.top().first <= 4000) { que.push({que.top().first + 5000, que.top().second}); que.pop(); } else { cout << que.top().second << endl; que.pop(); } } } } }