Pagini recente » Cod sursa (job #1685158) | Cod sursa (job #3263349) | Cod sursa (job #632428) | Cod sursa (job #2001963) | 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;
}