Pagini recente » Cod sursa (job #3165128) | Cod sursa (job #3221168) | Cod sursa (job #1003488) | Cod sursa (job #2135074) | Cod sursa (job #1257196)
#include <fstream>
#include <set>
#include <iostream>
using namespace std ;
const int NMAX = 200005 ;
ifstream fin("heap.in") ;
ofstream fout("heap.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 ;
}