Pagini recente » Cod sursa (job #582409) | Cod sursa (job #413253) | Cod sursa (job #2075384) | Cod sursa (job #2608605) | Cod sursa (job #539415)
Cod sursa(job #539415)
# include <cstdio>
# include <set>
# define open_files_read(x,y); freopen ("heapuri.in", "rt", stdin); freopen ("heapuri.out", "wt", stdout); scanf ("%d%d", &x, &y)
using namespace std;
int n, x, m, tip, poz[200001];
int main ()
{ open_files_read(n,tip);
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;
}