Cod sursa(job #2590859)
Utilizator | Data | 29 martie 2020 07:50:10 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.6 kb |
#include <bits/stdc++.h>
#define N_MAX 200005
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int Q, type, x;
int N, v[N_MAX];
set < int > heap;
int main()
{
fin >> Q;
while (Q--)
{
fin >> type;
if (type == 1)
{
fin >> x;
v[++N] = x;
heap.insert(x);
}
else if (type == 2)
{
fin >> x;
heap.erase(v[x]);
}
else if (type == 3)
{
fout << *heap.begin() << "\n";
}
}
return 0;
}