Pagini recente » Cod sursa (job #3243550) | Cod sursa (job #2467733) | Cod sursa (job #1472058) | Cod sursa (job #757428) | Cod sursa (job #2590852)
#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(lower_bound(heap.begin(), heap.end(), v[x]));
}
else if (type == 3)
{
fout << *lower_bound(heap.begin(), heap.end(), 0) << "\n";
}
}
return 0;
}