Cod sursa(job #2893171)
| Utilizator | Data | 25 aprilie 2022 13:22:43 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.67 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f ("heapuri.in");
ofstream g ("heapuri.out");
vector <int> h;
int ord[200001], n, o, op, a;
int main()
{
f>>n;
for ( int i = 1; i <= n; i++ )
{
f>>op;
if ( op==1 )
{
f>>a;
h.push_back(a);
o++;
ord[o]=a;
sort(h.begin(),h.end());
}
else if (op==2)
{
f>>a;
h.erase(find(h.begin(),h.end(),ord[a]));
}
else
{
g<<*h.begin();
g<<"\n";
}
}
return 0;
}