Pagini recente » Cod sursa (job #2135470) | Cod sursa (job #3261194) | Cod sursa (job #352349) | Cod sursa (job #1850301) | Cod sursa (job #539408)
Cod sursa(job #539408)
# include <cstdio>
# include <set>
# define open_files_read(x); freopen ("heapuri.in", "rt", stdin); freopen ("heapuri.out", "wt", stdout); scanf ("%d", &x)
using namespace std;
int n, x, m, tip, poz[200001];
int main ()
{ open_files_read(n);
set <int> rares;
set <int> :: iterator it;
for (; n; --n)
{ scanf ("%d", &tip);
if (tip < 3) scanf ("%d", &x);
if (tip == 1) {rares.insert(x); poz[++m] = x;}
if (tip == 2) rares.erase (poz[x]);
if (tip == 3) {it = rares.begin (); printf ("%d\n", *it);}
}
return 0;
}