Pagini recente » Cod sursa (job #601509) | Istoria paginii runda/infojobs/clasament | Istoria paginii runda/oji_2009_10/clasament | Rating Prioteasa Liviu (liviu_fl) | Cod sursa (job #2761970)
#include <fstream>
#include <vector>
#include <set>
using namespace std;
int n, x, y;
vector <int> v;
set <int> heap;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int main()
{
f>>n;
while (n>0)
{
f>>x;
if(x==1)
{
f>>y;
heap.insert(y);
v.push_back(y);
}
else if(x==2)
{
f>>y;
heap.erase(v[y-1]);
}
else
{
g<<*heap.begin()<<'\n';
}
n--;
}
f.close();
g.close();
}