Cod sursa(job #2744786)
| Utilizator | Data | 25 aprilie 2021 02:54:18 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set<int> heap;
int poz[200000],n,op,x,cont=1;
int main()
{
fin>>n;
for(int i = 0; i < n; i++){
fin>>op;
if(op == 1){
fin>>x;
poz[cont] = x;
cont++;
heap.insert(x);
}
else if(op == 2){
fin>>x;
heap.erase(poz[x]);
}
else if(op == 3){
set <int> :: iterator it = heap.begin();
fout<<*it<<endl;
}
}
return 0;
}
