Cod sursa(job #2567133)
| Utilizator | Data | 3 martie 2020 15:20:33 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.98 kb |
#include <bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
ifstream fin( "heapuri.in" );
ofstream fout( "heapuri.out" );
void fast()
{
cin.tie( 0 );
ios_base::sync_with_stdio( 0 );
}
int n;
set<int>heap;
int ord[200005], k;
int main()
{
fast();
fin >> n;
for( int i = 1; i <= n; i++ )
{
int t;
fin >> t;
if( t == 3 )
fout << *heap.begin() << '\n';
else
{
int x;
fin >> x;
if( t == 1 )
{
k++;
ord[k] = x;
heap.insert( x );
continue;
}
heap.erase( heap.find( ord[x] ) );
}
}
return 0;
}
