Pagini recente » Cod sursa (job #178858) | Cod sursa (job #398216) | Rezultatele filtrării | Cod sursa (job #3285883) | Cod sursa (job #2218061)
#include <fstream>
#include <set>
#define Nmax 200002
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n, p, o[Nmax];
set <int> heap;
int tip, x;
int main()
{
f >> n;
for ( int i = 1; i <= n; i ++ )
{
f >> tip;
if( tip == 1)
{
f >> x;
o[++p]=x;
heap.insert(x);
} else
if(tip == 2)
{
f >> x;
heap.erase(o[x]);
}
else
if(tip == 3) g << *heap.begin() << '\n';
}
return 0;
}