Cod sursa(job #2218061)
Utilizator | Data | 3 iulie 2018 11:15:35 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.58 kb |
#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;
}