結果

問題 No.2804 Fixer And Ratism
ユーザー kotatsugame
提出日時 2024-07-12 21:09:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 746 bytes
コンパイル時間 955 ms
コンパイル使用メモリ 88,784 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-12 21:09:55
合計ジャッジ時間 3,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#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;now=min(now,(int)1e9);
			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));
			}
		}
		while(now<cur.size())
		{
			cout<<cur.begin()->second<<"\n";
			cur.erase(cur.begin());
		}
	}
}
0