Cod sursa(job #614185)
Utilizator | Data | 5 octombrie 2011 20:12:18 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.46 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;
}