Cod sursa(job #2979645)
Utilizator | Data | 15 februarie 2023 17:59:46 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.48 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set<int> heap;
int v[200001], nr, n, op, x;
int main(){
fin >> n;
while(n--){
fin >> op;
if(op == 1){
fin >> x;
heap.insert(x);
v[++nr] = x;
}else if(op == 2){
fin >> x;
heap.erase(v[x]);
}else{
fout << *heap.begin() << '\n';
}
}
return 0;
}