目录
操作序列【STL维护】
#include<bits/stdc++.h>
using namespace std;
map<int,int>mp;
string s,a;
int main(void)
{
int t; cin>>t;
getline(cin,s);
while(t--)
{
getline(cin,s);
stringstream l(s);
vector<int>ve;
while(l>>a) ve.push_back(stoi(a));
if(ve.size()==1)
{
if(ve[0]==-1)
{
auto temp=mp.begin();
if(temp==mp.end()) puts("skipped");
else
{
cout<<temp->second<<'\n';
mp.erase(temp);
}
}
else
{
if(mp.count(ve[0])) cout<<mp[ve[0]]<<'\n';
else cout<<0<<'\n';
}
}else
{
bool flag=1;
for(int i=ve[0]-30;i<=ve[0]+30;i++)
if(mp.count(i)&&mp[i]>0) flag=0;
if(flag) mp[ve[0]]+=ve[1];
}
}
return 0;
}