Pagini recente » Cod sursa (job #1765229) | Cod sursa (job #2791968) | Cod sursa (job #1921798) | Cod sursa (job #519022) | Cod sursa (job #2819401)
#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;
}