Cod sursa(job #1160912)
| Utilizator | Data | 30 martie 2014 21:48:37 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n,tip,val,V[200009];
set < int > heap;
int main()
{
f >> n;
for(int nr=0, i=1; i<=n; i++)
{
f >> tip;
if(tip == 1)
{
f >> val;
V[++nr] = val;
heap.insert(val);
}
else if(tip == 2)
{
f >> val;
heap.erase(V[val]);
}
else
{
g << *heap.begin() << '\n';
}
}
g.close();
return 0;
}
