Cod sursa(job #2682609)

Utilizator andrei.florea0405Florea Andrei-Bogdan andrei.florea0405 Data 9 decembrie 2020 00:13:01
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.84 kb
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

ifstream fin("heapuri.in");
ofstream fout("heapuri.out");

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    fin >> t;
    set<int> s;
    vi a;
    a.pb(0);
    while (t--) {
        int op, x;
        fin >> op;
        if (op == 1) {
            fin >> x;
            s.insert(x);
            a.pb(x);
        } else if (op == 2) {
            fin >> x;
            s.erase(a[x]);
        } else {
            fout << *s.begin() << "\n";
        }
    }

    return 0;
}