Pagini recente » Cod sursa (job #1770611) | Cod sursa (job #1031588) | Cod sursa (job #1030570) | Cod sursa (job #1784188) | 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;
}