Pagini recente » Cod sursa (job #2761375) | Cod sursa (job #451488) | Cod sursa (job #2553421) | Cod sursa (job #2050047) | Cod sursa (job #1052000)
#include <cstdio>
#include <set>
#include <vector>
using namespace std;
int main(){
freopen("heapuri.in", "r", stdin);
freopen("heapuri.out", "w", stdout);
int n;
vector<int> op;
set<int> wowsucheasy;
scanf("%d", &n);
for(int i = 1; i <= n; ++i){
int tip;
scanf("%d", &tip);
if(tip == 1){
int x;
scanf("%d", &x);
op.push_back(x);
wowsucheasy.insert(x);
}
else if(tip == 2){
int x;
scanf("%d", &x);
wowsucheasy.erase(op[x - 1]);
}
else
printf("%d\n", *wowsucheasy.lower_bound(-1));
}
return 0;
}