Cod sursa(job #2681192)
Utilizator | Data | 5 decembrie 2020 09:43:27 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.51 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int> h;
int n,a,b,loc[200005],k;
int main()
{
f>>n;
for(int i=1; i<=n; i++)
{
f>>a;
if(a==1)
{
f>>b;
h.insert(b);
loc[++k]=b;
}
else if(a==3)
{
g<<*h.begin()<<'\n';
}
else
{
f>>b;
h.erase(loc[b]);
}
}
return 0;
}