Cod sursa(job #2741671)
| Utilizator | Data | 17 aprilie 2021 15:21:05 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
int v[200002],i,n,op,x,k=0;
set<int>heap;
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[k]=x;
k++;
}
if (op==2)
{
f>>x;
heap.erase(v[x-1]);
}
if (op==3)
{
g<<*heap.begin()<<endl;
}
}
f.close();
g.close();
return 0;
}
