Cod sursa(job #2772295)
| Utilizator | Data | 31 august 2021 17:16:15 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <iostream>
#include <fstream>
#include<set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int>h;
int main()
{
int N,v[200001];
f>>N;
int comanda,x,i,k=1;
for(i=1; i<=N; i++)
{
f>>comanda;
if(comanda==1)
{
f>>x;
h.insert(x);
v[k]=x;
k++;
}
else if(comanda==2)
{
f>>x;
h.erase(v[x]);
}
else
{
g<<*h.begin()<<endl;
}
}
return 0;
}
