Pagini recente » Cod sursa (job #248845) | Cod sursa (job #2268940) | Cod sursa (job #1281567) | Cod sursa (job #2717814) | Cod sursa (job #1609564)
#include<fstream>
#include<set>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");
set<int>h;
int n,c,x,l,v[200001];
int main(){
in>>n;
while(n--){
in>>c;
if(c<3){
in>>x;
if(c==1) h.insert(x),v[++l]=x;
else if(c==2){
set<int> ::iterator it = h.find(v[x]);
if(it != h.end()) h.erase(it);
}
}
else out<<*h.begin()<<'\n';
}
return 0;
}