Cod sursa(job #2623653)

Utilizator anacomoAna-Maria Comorasu anacomo Data 3 iunie 2020 15:53:55
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.59 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");

multiset<int> heap;
int n, loc, v[200005];

int main()
{
    int choice, value;
    fin >> n;
    for (int i = 0; i < n; i++)
    {
        fin >> choice;
        if (choice == 1)
        {
            fin >> value;
            heap.insert(value);
            v[++loc] = value;
        }
        else if (choice == 2)
        {

            fin >> value;
            heap.erase(v[value]);
        }
        else
        {
            fout << *heap.begin() << "\n";
        }
    }
    return 0;
}