Cod sursa(job #3322771)

Utilizator octavurlurleteanu alexandru octavian octavurl Data 15 noiembrie 2025 16:46:36
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.6 kb
#include <bits/stdc++.h>

using namespace std;

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

signed main()
{
    int n ;
    fin >> n ;
    multiset<int>s;
    vector<int>v;
    v.push_back(0);
    for ( int i = 1 ; i <= n ; ++ i )
    {
    int c  ;
    fin >> c ;
    if ( c == 1 )
    {
    int x;
    fin >> x;
    v.push_back(x);
    s.insert(x);
    }
    else if ( c == 2 )
        {
            int poz ;
            fin >> poz ;
            s.erase(s.find(v[poz]));
        }
    else
        fout << *s.begin() << '\n' ;
    }
    return 0;
}