Mai intai trebuie sa te autentifici.
Cod sursa(job #2626040)
Utilizator | Data | 6 iunie 2020 11:33:28 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.57 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n, a[200005], ord = 0;
set <int> heap;
int i, op, x;
f>>n;
for(i=0; i<n; i++)
{
f>>op;
if(op == 1)
{
f>>x;
heap.insert(x);
a[++ord] = x;
}
else if(op == 2)
{
f>>x;
heap.erase(a[x]);
}
else
g<<*(heap.begin())<<"\n";
}
return 0;
}