The isodiametric problem on the sphere and in the hyperbolic space