Cod sursa(job #2365970)
| Utilizator | Data | 4 martie 2019 17:44:58 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.61 kb |
#include <fstream>
#include <vector>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int N;
set <int> heap;
vector <int> ins;
int main()
{
fin >> N;
int type, x;
for(int i = 1; i <= N; i++)
{
fin >> type;
if(type == 1)
{
fin >> x;
ins.push_back(x);
heap.insert(x);
}
else if(type == 2)
{
fin >> x;
heap.erase(ins[x - 1]);
}
else
fout << *heap.begin() << '\n';
}
return 0;
}
