Cod sursa(job #1293891)
Utilizator | Data | 16 decembrie 2014 18:35:53 | |
---|---|---|---|
Problema | Heapuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set <int>h;
int n,x,k,y,a[200001];
int main()
{
f>>n;
for(int i=1;i<=n;i++)
{
f>>x;
if(x==1)
{
f>>y;
h.insert(y);
a[k++]=y;
}
else if(x==2)
{
f>>y;
h.erase(h.find(a[y]));
}
else
g<<*h.begin()<<'\n';
}
return 0;
}