Cod sursa(job #616031)

Utilizator rzvrzvNicolescu Razvan rzvrzv Data 11 octombrie 2011 16:22:35
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.35 kb
#include <fstream>
#include <set>
using namespace std;
 
set <int> h;
int nr,i,n,inst,x,a[200001];
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>n;
for (i=1;i<=n;i++) {
f>>inst;
if (inst==1)
{
f>>x;
a[++nr]=x;
h.insert(x);
}
else if (inst==2)
{
f>>x;
h.erase(a[x]);
}
else g<< *h.begin () <<'\n';
}
return 0;
}