Cod sursa(job #2253196)
Utilizator | Data | 3 octombrie 2018 19:07:12 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.61 kb |
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
#define nmax 200005
set <int> heap;
int v[nmax];
int main()
{
int n;
fin >> n;
int pos = 0;
for(int i = 1; i <= n; i++)
{
int cod;
fin >> cod;
if(cod == 1)
{
pos ++;
fin >> v[pos];
heap.insert(v[pos]);
}
else if(cod == 2)
{
int x;
fin >> x;
heap.erase(v[x]);
}
else
fout << *heap.begin() << '\n';
}
return 0;
}