Cod sursa(job #2741196)

Utilizator AlexandraBoghiuAlexandra Boghiu AlexandraBoghiu Data 15 aprilie 2021 17:52:28
Problema Heapuri Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.53 kb
#include <bits/stdc++.h>
using namespace std;
ifstream F ("heapuri.in");
ofstream G ("heapuri.out");
set <int> heap;
int main()
{
    int n, op, ord[200001], x, k = 0;
    F>>n;
    for(int i = 0; i < n; i++)
    {
        F>>op;
        if(op == 1)
        {
            F>>x;
            ord[++k] = x;
            heap.insert(x);
        }
        if(op == 2)
        {
            F>>x;
            heap.erase(ord[x]);
        }
        else if (op == 3)
            G<<*heap.begin()<<endl;

    }
    return 0;
}