Pagini recente » Cod sursa (job #1556918) | Profil Mirceamp | Cod sursa (job #763026) | Cod sursa (job #3321094) | Cod sursa (job #3322771)
#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(s.find(v[poz]));
}
else
fout << *s.begin() << '\n' ;
}
return 0;
}