Cod sursa(job #2761970)
| Utilizator | Data | 4 iulie 2021 17:12:04 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <fstream>
#include <vector>
#include <set>
using namespace std;
int n, x, y;
vector <int> v;
set <int> heap;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int main()
{
f>>n;
while (n>0)
{
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()<<'\n';
}
n--;
}
f.close();
g.close();
}
