Cod sursa(job #1036321)

Utilizator techLaurentiu Avasiloaie tech Data 19 noiembrie 2013 10:38:53
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.72 kb
#include <fstream>
#include <iostream>
#include <set>

using namespace std;

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

long long unsigned n , i , x , y , nr , vect[200001] ;

int main()
{
    fin >> n ;

    multiset <int> hp;

    for ( i = 1 ; i <= n ; i ++ )
    {
        fin >> y ;

        if ( y == 1 )
        {
            fin >> x ;
            hp.insert(x) ;

            vect[++nr] = x ;
        }
        else if ( y == 2 )
        {
            fin >> x ;
            hp.erase(hp.find(vect[x])) ;
        }
        else
        {
            multiset <int> :: iterator it = hp.begin() ;
            fout << *it << "\n" ;
        }
    }

    return 0;
}