Pagini recente » Cod sursa (job #1547216) | Cod sursa (job #1904751) | Cod sursa (job #2072084) | Clasament simulare-cartita-22 | Cod sursa (job #472380)
Cod sursa(job #472380)
#include<fstream>
#include<set>
using namespace std;
#define nm 200001
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n,k,op,x;
int on[nm];
set<int>heap;
set<int>::iterator it;
int main()
{ f>>n;
k=1;
for(int i=1;i<=n;i++)
{ f>>op;
if(op==1)
{ f>>x;
heap.insert(x);
on[k++]=x;
}
else
if(op==2)
{ f>>x;
heap.erase(on[x]);
on[x]=-1;
}
else
{ it=heap.begin();
g<<*it<<'\n';
}
}
f.close();
g.close();
return 0;
}