Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- #define MAX 10002
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- int n, tope = 0;
- cin >> n;
- int v[MAX];
- for(int i = 0; i < n; i++) {
- int op;
- cin >> op;
- if(op == 0) {
- sort(v, v + tope);
- for(int it = 0; it < tope; it++)
- cout << v[it] << " ";
- cout << "\n";
- }
- else if(op == 1) { //Agregar
- int test;
- cin >> test;
- v[tope] = test;
- tope++;
- }
- else { //Borrar
- int test;
- cin >> test;
- int idx = lower_bound(v, v + tope, test) - v;
- v[idx] = (1<<30);
- sort(v, v + tope);
- tope--;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement