Cod sursa(job #1608499)

Utilizator eu3neuomManghiuc Teodor-Florin eu3neuom Data 22 februarie 2016 09:44:17
Problema Heapuri Scor 10
Compilator cpp Status done
Runda Arhiva educationala Marime 0.6 kb
#include <bits/stdc++.h>

using namespace std;

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

const int NMax = 2e5 + 5;

int Pos[NMax];

set < int > Set;

int main(){
    int n, c, x, k;
    fin >> n;
    k = 0;
    while(n--){
        fin >> c;
        if(c == 1){
            fin >> x;
            Pos[++k] = x;
            Set.insert(x);
        } else {
            if(c == 2){
                fin >> x;
                Set.erase(Set.find(Pos[x]));
            } else {
                fout << *Set.begin() << "\n";
            }
        }
    }
    return 0;
}