Cod sursa(job #2753766)
Utilizator | Data | 24 mai 2021 12:15:24 | |
---|---|---|---|
Problema | Heapuri | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.58 kb |
#include <fstream>
#include <vector>
#include <set>
using namespace std;
int n, x, y, i;
vector <int> v;
set <int> heap;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int main()
{
f>>n;
for(i=0; i<n;i++)
{
f>>x;
if(x==1)
{
f>>y;
heap.insert(y);
v.push_back(y);
}
else if(x==2)
{
f>>y;
heap.erase(v[y-1]);
}
else
{
g<<*heap.begin()<<endl;
}
}
return 0;
}