the formula for wrok done is
F d cosθ
when we apply force in the upward or downward direction(in case of opposing gravity) perpendicular to direction of displacement 90 degrees ,as in this example the angle bewteen the force and the displacement is 90 and cos90 is zero. hence work done is zero.