Physics is a bit difficult, I try to explain.
You know that the acceleration formula (to find the distance) is d=1/2at^2, when you have no initial distance and no initial speed.
d=1/2gt^2 is the formula for the Free Fall (the only acceleration that acts on the object is the Gravity Acceleration) and since we consider the y-axis positive when oriented up, it solves from ground to peak (object thrown upward).
The formula when the object goes downwards is d=v0t - 1/2gt^2
Hope it's clear, in case leave a comment.