Cod sursa(job #1052000)
| Utilizator | Data | 10 decembrie 2013 19:55:01 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#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;
}
