Pagini recente » Cod sursa (job #1386008) | Cod sursa (job #1823927) | Cod sursa (job #120294) | Cod sursa (job #1163149) | Cod sursa (job #480711)
Cod sursa(job #480711)
#include <cstdio>
#include <set>
//#include <ctime>
using namespace std;
#define file_in "heapuri.in"
#define file_out "heapuri.out"
//long long my_time;
int T;
int cnt[1<<18];
multiset<int> H;
#define dim 8192
char a[dim];
int p;
inline void citire(int &x)
{
x=0;
while(a[p]<'0' || a[p]>'9')
if(++p==dim)
fread(a,1,dim,stdin),p=0;
while(a[p]>='0' && a[p]<='9')
{
x=x*10+a[p]-'0';
if(++p==dim)
fread(a,1,dim,stdin),p=0;
}
}
void adfile()
{
freopen(file_in,"r",stdin);
freopen(file_out,"w",stdout);
citire(T);
}
void solve()
{
int tip,x,nr=0;
while(T--)
{
citire(tip);
if (tip!=3) citire(x);
if (tip==1)
{
cnt[++nr]=x;
H.insert(x);
}
if (tip==2)
{
H.erase(H.find(cnt[x]));
}
if (tip==3)
printf("%d\n", *H.begin());
}
//printf ("Solution ended in %.4lf\n",(double)((double)clock()-my_time)/CLOCKS_PER_SEC);
}
int main()
{
//my_time=clock();
adfile();
solve();
return 0;
}