Pagini recente » Cod sursa (job #2729036) | Cod sursa (job #1273520) | Cod sursa (job #3005707) | Cod sursa (job #2871243) | Cod sursa (job #1577117)
#include <fstream>
#include <set>
#include <algorithm>
using namespace std;
ofstream fout ( "heapuri.out" ) ;
set<int> H ;
int n , op , value , timp[200200] , beg ;
void read()
{
freopen ( "heapuri.in" , "r" , stdin ) ;
scanf ( "%d" , &n ) ;
for ( int i = 1 ; i <= n ; i++ )
{
scanf ( "%d" , &op ) ;
{
if ( op == 1 )
{
scanf ( "%d" , &value ) ;
timp[++beg] = value ;
H.insert(value) ;
}
if ( op == 2 )
{
scanf ( "%d" , &value ) ;
H.erase(timp[value]) ;
}
if ( op == 3 )
fout <<*H.begin() << '\n' ;
}
}
}
int main()
{
read() ;
return 0;
}