Pagini recente » Monitorul de evaluare | Cod sursa (job #1367102) | Cod sursa (job #1411085) | Cod sursa (job #3322292) | Cod sursa (job #3322770)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ( "heapuri.in" ) ;
ofstream fout ( "heapuri.out" ) ;
signed main()
{
int n ;
fin >> n ;
multiset<int>s;
vector<int>v;
v.push_back(0);
for ( int i = 1 ; i <= n ; ++ i )
{
int c ;
fin >> c ;
if ( c == 1 )
{
int x;
fin >> x;
v.push_back(x);
s.insert(x);
}
else if ( c == 2 )
{
int poz ;
fin >> poz ;
s.erase(lower_bound(s.begin(),s.end(),v[poz]));
}
else
fout << *s.begin() << '\n' ;
}
return 0;
}