Cod sursa(job #2748144)
Utilizator | Data | 29 aprilie 2021 22:57:07 | |
---|---|---|---|
Problema | Heapuri | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.75 kb |
#include <fstream>
#include <vector>
#include <set>
using namespace std;
int n, x, y, val;
vector <int> v;
set <int> heap;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int main()
{
f>>n;
while(n)
{
f>>x;
n--;
switch(x)
{
case 1:
{
f>>y;
heap.insert(y);
v.push_back(y);
break;
}
case 2:
{
f>>y;
heap.erase(v[y-1]);
break;
}
case 3:
{
g<<*heap.begin()<<endl;
break;
}
}
}
f.close();
g.close();
}