Pagini recente » Cod sursa (job #1404551) | Cod sursa (job #1477929) | Cod sursa (job #886045) | Cod sursa (job #280632) | Cod sursa (job #1257197)
#include <fstream>
#include <set>
#include <iostream>
using namespace std ;
const int NMAX = 200005 ;
ifstream fin("heapuri.in") ;
ofstream fout("heapuri.out") ;
int N ;
multiset <int> H ;
int ord[NMAX] ;
int main()
{
fin >> N ;
int cnt = 0 ;
for(int i = 1 ; i <= N ; ++ i)
{
int x ;
fin >> x ;
if(x == 1)
{
int y ;
fin >> y ;
H.insert(y) ;
ord[cnt] = y ;
++ cnt ;
}
else if(x == 2)
{
int y ;
fin >> y ;
H.erase(ord[y - 1]) ;
}
else if(x == 3)
{
multiset <int> :: iterator it = H.begin() ;
fout << *it << '\n' ;
}
}
fin.close() ;
fout.close() ;
return 0 ;
}