結果
| 問題 |
No.2804 Fixer And Ratism
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-12 21:15:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 2,000 ms |
| コード長 | 904 bytes |
| コンパイル時間 | 1,446 ms |
| コンパイル使用メモリ | 102,132 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-12 21:16:06 |
| 合計ジャッジ時間 | 3,678 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cassert>
using namespace std;
int now;
int Q;
map<string,int>R;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>now>>Q;
set<pair<int,string> >cur;
for(;Q--;)
{
int op;cin>>op;
if(op==1)
{
string s;int r;cin>>s>>r;
R[s]=r;
cur.insert(make_pair(R[s],s));
}
else if(op==2)
{
int x;cin>>x;
now-=x;
}
else
{
string s;int x;cin>>s>>x;
now+=x;
assert(cur.find(make_pair(R[s],s))!=cur.end());
if(R[s]<=4000)
{
cur.erase(make_pair(R[s],s));
R[s]+=10000;
cur.insert(make_pair(R[s],s));
}
}
vector<pair<int,string> >out;
while(now<cur.size())
{
auto p=*cur.begin();
cur.erase(cur.begin());
out.push_back(make_pair(p.first%10000,p.second));
}
sort(out.begin(),out.end());
for(auto p:out)cout<<p.second<<"\n";
}
}