Cod sursa(job #2906479)
Utilizator | Data | 26 mai 2022 10:40:58 | |
---|---|---|---|
Problema | Heapuri | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.53 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout("heapuri.out");
set<int> h;
int n,x,v[200006],poz,y;
int main()
{
fin>>n;
for(int i=1;i<=n;i++)
{
fin>>x;
if(x==1)
{
fin>>y;
h.insert(y);
v[++poz]=y;
}
else if(x==2)
{
fin>>y;
h.erase(v[y]);
}
else if(x==3)
{
fout<<*h.begin()<<"\n";
}
}
return 0;
}