Cod sursa(job #2681190)
Utilizator | Data | 5 decembrie 2020 09:42:03 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.53 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set <int> h;
int n,x,i,p,k,poz[200001];
int main()
{
fin>>n;
for(i=1;i<=n;i++)
{
fin>>p;
if(p==1)
{
fin>>x;
h.insert(x);
poz[++k]=x;
}
if(p==2)
{
fin>>x;
h.erase(poz[x]);
}
if(p==3)
{
fout<<*h.begin()<<'\n';
}
}
return 0;
}