Cod sursa(job #3322770)
| Utilizator | Data | 15 noiembrie 2025 16:44:20 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
#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;
}
