Pagini recente » Cod sursa (job #2397908) | Cod sursa (job #3273836) | Cod sursa (job #2259413) | Cod sursa (job #1054728) | 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;
}