Cod sursa(job #2737226)
| Utilizator | Data | 4 aprilie 2021 15:48:14 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.61 kb |
#include <fstream>
#include <set>
#include <vector>
using namespace std;
int i,n,op,x;
multiset<int>heap;
vector<int>v;
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>n;
for (i=0;i<n;i++)
{
f>>op;
if (op==1)
{
f>>x;
heap.insert(x);
v.push_back(x);
}
else if (op==2)
{
f>>x;
heap.erase(heap.find(v[x-1]));
}
else
{
g<<*heap.begin()<<endl;
}
}
f.close();
g.close();
return 0;
}