Cod sursa(job #2930409)

Utilizator DKMKDMatei Filibiu DKMKD Data 28 octombrie 2022 13:08:40
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.51 kb
#include <bits/stdc++.h>
#define N 200005

using namespace std;

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

int v[N],n, t, x, k;
set<int> s;
int main() {
    fin >> n;
    for (int i = 1; i <= n; i++) {
        fin >> t;
        if (t == 1) {
            fin >> x;
            v[++k] = x;
            s.insert(x);
        }
        else if (t == 2) {
            fin >> x;
            s.erase(v[x]);
        }
        else
            fout << *s.begin() << "\n";
    }
    return 0;
}