Pagini recente » Rezultatele filtrării | Cod sursa (job #2864818) | Cod sursa (job #262422) | Borderou de evaluare (job #890702) | Cod sursa (job #502285)
Cod sursa(job #502285)
#include <fstream.h>
#include <set.h>
#include <iostream.h>
using namespace std;
set <int> heap;
int n,x,i,c,v[200005];
int main(){
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>n;
for (i=0; i<n; i++){
f >> c;
if (c==1){
f>>x;
heap.insert(x);
v[0]+=1;
v[v[0]]=x;
}
if (c==2){
f>>x;
heap.erase(v[x]);
}
if (c==3){
g<<*heap.begin()<<endl;
}
}
f.close();
g.close();
return 0;
}