Pagini recente » Cod sursa (job #259065) | Cod sursa (job #1204582) | Cod sursa (job #509105) | Cod sursa (job #2988836) | Cod sursa (job #1739360)
#include <fstream>
#include <set>
using namespace std;
unsigned int N;
unsigned short int type;
unsigned int x;
set <int> a;
int v[100001];
unsigned int i, k;
int main ()
{
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
fin >> N;
for (i=1; i<=N; i++)
{
fin >> type;
if (type == 1)
{
fin >> x;
k++;
a.insert(x);
v[k] = x;
}
else if (type == 2)
{
fin >> x;
a.erase(v[x]);
}
else
fout << *a.begin() << '\n';
}
fin.close();
fout.close();
return 0;
}