Selberg integrals in 1D random Euclidean optimization problems