Cod sursa(job #2617775)

Utilizator srazvan100@gmail.comRazvan Alexandru Sandu [email protected] Data 22 mai 2020 20:40:38
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.65 kb
// // https://www.infoarena.ro/problema/heapuri

#include <bits/stdc++.h>
using namespace std;

int main() {
    ifstream fin("heapuri.in");
    ofstream fout("heapuri.out");
    int n, x;
    set<int> s;
    vector<int> v;
    fin >> n;
    for (int i = 0; i < n; i++) {
        int t;
        fin >> t;
        switch (t) {
            case 1:
                fin >> x;
                s.insert(x);
                v.push_back(x);
                break;
            case 2:
                fin >> x;
                s.erase(v[x - 1]);
                break;
            default:
                fout << *s.begin() << '\n';
                break;
        }
    }
}