Work=Fscosθ
where, F is the force applied, s is the displacement, and θ is the angle between the force applied and displacement
Hence, work done is independent of time taken.
In the given cases, θ=0∘ as the force applied are in the same direction. Also, F=mg
So W=Fs=mgs
In both the cases, mass and displacement are the same.
W=50×10×2=1000J