Cod sursa(job #2904855)
Utilizator | Ciocoiu Vlad vlad082002 | Data | 18 mai 2022 10:29:07 |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int n, cod, x, pos[200005], p;
int main() {
set<int> st;
fin >> n;
while(n--) {
fin >> cod;
if(cod == 1 || cod == 2) fin >> x;
if(cod == 1) {
st.insert(x);
pos[++p] = x;
} else if(cod == 2) {
st.erase(pos[x]);
} else {
fout << *st.begin() << '\n';
}
}
}