Cod sursa(job #1710585)
| Utilizator | Data | 29 mai 2016 12:36:05 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
fstream fout("heapuri.out");
set <int> s;
set <int>::iterator it;
int q,i,n,x,k,v[200010];
int main()
{
fin >>n;
for (i=1;i<=n;i++)
{
fin >> q;
if (q==1)
{
fin >>x;
s.insert(x);
v[++k]=x;
}
if (q==2)
{
fin >>x;
s.erase(v[x]);
}
if (q==3)
{
it=s.begin();
fout<<*it<<'\n';
}
}
return 0;
}
