Pagini recente » Cod sursa (job #2471820) | Cod sursa (job #2761496) | Cod sursa (job #1414393) | Cod sursa (job #2449576) | Cod sursa (job #830394)
Cod sursa(job #830394)
#include <fstream>
#include <set>
using namespace std;
const char iname[] = "heapuri.in";
const char oname[] = "heapuri.out";
ifstream fin(iname);
ofstream fout(oname);
int N , op , x , i , nr;
int poz[ 200004 ];
set < int > H;
set < int > :: iterator it;
int main()
{
fin >> N;
for ( i = 1; i <= N; ++i )
{
fin >> op;
if ( op == 3 )
{
it = H.begin();
fout << *it << '\n';
}
else
{
fin >> x;
if ( op == 1 )
{
H.insert( x );
++nr;
poz[ nr ] = x;
}
else
H.erase( poz[ x ] );
}
}
return 0;
}