Cod sursa(job #3131706)
Utilizator | Data | 21 mai 2023 10:10:29 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int v[200001],l,n;
int main() {
f>>n;
set<int> heap;
int c,x;
for(int i=1;i<=n;i++)
{
f>>c;
if(c==1)
{
f>>x;
v[l++]=x;
heap.insert(x);
}
if(c==2)
{
f>>x;
heap.erase(v[x-1]);
}
if(c==3)
{
g<<*heap.begin()<<endl;
}
}
}