Cod sursa(job #2819401)
Utilizator | Data | 18 decembrie 2021 12:10:28 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.47 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set<int> h;
int n, x, p, k;
int loc[200005];
int main() {
fin >> n;
for (int i=1;i<=n;i++){
fin >> p;
if (p == 1){
fin >> x;
h.insert(x);
loc[++k] = x;
}else if (p == 2){
fin >> x;
h.erase(loc[x]);
}else{
fout << *h.begin() << '\n';
}
}
return 0;
}