Pagini recente » Cod sursa (job #1863299) | Cod sursa (job #2476020) | Cod sursa (job #1603415) | Cod sursa (job #1286456) | Cod sursa (job #2590851)
#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 << *lower_bound(heap.begin(), heap.end(), 0) << "\n";
}
}
return 0;
}