Cod sursa(job #2906454)
| Utilizator | Data | 26 mai 2022 08:34:31 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int n, p, x, mini = 1e6, y = 0;
vector<int> v;
set<int>heap;
int main()
{
while(n--)
{
fin >> p;
if(p == 1)
{
fin >> x;
heap.insert(x);
v.push_back(x);
}
else if(p == 2)
{
fin >> x;
heap.erase(v[x - 1]);
}
else
{
fout << *(heap.begin()) << '\n';
}
}
return 0;
}
