Cod sursa(job #2724269)
| Utilizator | Data | 16 martie 2021 20:37:22 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <fstream>
#include <set>
using namespace std;
#define NMAX 200005
ifstream cin("heapuri.in");
ofstream cout("heapuri.out");
set <int> h;
int a[NMAX],n;
int main()
{
int op, x, m, nr_ord=0;
cin>>m;
for(;m;m--)
{
cin>>op;
if(op==1)
{
cin>>x;
a[++n]=x;
h.insert(x);
}
if(op==2)
{
cin>>x;
h.erase(a[x]);
}
if(op==3)
cout<<*h.begin()<<"\n";
}
return 0;
}
