Cod sursa(job #1046560)
Utilizator | Data | 3 decembrie 2013 09:19:31 | |
---|---|---|---|
Problema | Heapuri | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
#include <set>
using namespace std;
set <int> v;
int x,n,i,key,q,a[500002];
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>n;
for (i=1;i<=n;i++)
{
f>>key;
if (key==1) f>>x,v.insert(x),a[++q]=x;
if (key==2) f>>x,v.erase(v.find(a[x]));
if (key==3) g<<*v.begin()<<'\n';
}
f.close();
g.close();
return 0;
}