結果

問題 No.2804 Fixer And Ratism
ユーザー GOTKAKO
提出日時 2024-07-12 21:15:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 834 bytes
コンパイル時間 2,406 ms
コンパイル使用メモリ 209,736 KB
最終ジャッジ日時 2025-02-22 03:23:20
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N,Q; cin >> N >> Q;
    int ok = N,mem = 0;
    set<tuple<int,int,string>> S;
    map<string,int> rate;
    while(Q--){
        int t; cin >> t;
        if(t == 1){
            string s; int r; cin >> s >> r;
            S.insert({0,r,s});
            rate[s] = r; mem++;
        }
        if(t == 2){
            int x; cin >> x;
            ok -= x;
        }
        if(t == 3){
            string s; int x; cin >> s >> x;
            int ra = rate[s];
            S.erase({0,ra,s});
            S.insert({1,ra,s});
            ok += x;
        }
        while(ok < mem){
            auto &[ig,ign,s] = *S.begin();
            cout << s << "\n";
            S.erase(S.begin()); mem--;
        }
    }
}
0