Pagini recente » Cod sursa (job #879255) | Cod sursa (job #1041000) | Cod sursa (job #1264592) | Cod sursa (job #1938231) | Cod sursa (job #2571106)
#include <iostream>
#include <fstream>
#include <set>
#define NMAX 200000
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int q, a[NMAX+10], k;
set <int> s;
int main()
{
f >> q;
while(q--)
{ int type;
f >> type;
if(type == 1)
{ int x;
f >> x;
a[++k] = x;
s.insert(x);
}
else if(type == 2)
{ int x;
f >> x;
s.erase(a[x]);
}
else g << *s.begin() << '\n';
}
return 0;
}