Topological equivalence of some variational problems involving distances