Cod sursa(job #3277522)

Utilizator AndreiNicolaescuEric Paturan AndreiNicolaescu Data 16 februarie 2025 15:49:08
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.63 kb
#include <bits/stdc++.h>
#define cin ci
#define cout co
using namespace std;
ifstream cin("heapuri.in");
ofstream cout("heapuri.out");
vector<int> v;
multiset<int> heap;
int n, c, x;
int main()
{
    cin >> n;
    while(n--)
    {
        cin >> c;
        if(c == 1)
        {
            cin >> x;
            heap.insert(x);
            v.push_back(x);
        }
        else
            if(c == 3)
            {
                cout << *heap.begin() << '\n';;
            }
            else
            {
                cin >> x;
                heap.erase(v[x - 1]);
            }
    }
    return 0;
}