Cod sursa(job #2742202)
| Utilizator | Data | 20 aprilie 2021 14:12:12 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
#include <bits/stdc++.h>
#define nmax 200005
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set<int>heap;
int poz[nmax], k;
int main()
{
int op, q, x;
fin >> q;
for(; q; q--)
{
fin >> op;
if (op == 1)
{
fin >> x;
poz[++k] = x;
heap.insert(x);
}
else if(op == 2)
{
fin >> x;
heap.erase(poz[x]);
}
else fout << *heap.begin() << "\n";
}
return 0;
}
