The expression commonly used for potential gravitational energy is just simplification. It is actually just the first term in Taylor expansion of the real expression.
In general, the potential energy of gravitational field is defined as:

Where G is universal gravitational constant, and r is the distance between the objects centers of mass. Negative sign represents the bound state.
Since we are not given the mass of the planet we have to calculate it.

This formula can be used for any planet. It gives you the gravitational acceleration on the planet's surface. We can use it to calculate the planet's mass:

Now we can calculate the potential energy of that cannonball when it reaches its maximum height.

When we plug in the numbers we get:

The potential energy has to be equal to the kinetic energy.