Pagini recente » Cod sursa (job #2685237) | Cod sursa (job #1726525) | Cod sursa (job #2419196) | Cod sursa (job #555751) | 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 ;
}