No need for a free body diagram really.
In the stationary lift, normal gravity acts on the spring. Assuming the spring's mass is negligible compared to M, then the force on the spring is:
F = Mg
Invoking Hooke's law, tells us the spring constant, k:
Mg = kx --> k = Mg/(5 cm)
Now when the lift accelerates upwards at 4g, this means there is an extra fictious force (in the accelerating frame) of 4Mg acting upon the spring:
Fnew = mg + 4Mg = 5Mg
And again using Hooke's law, we find the new extension:
5Mg = kxnew ---> xnew = 5Mg/k = 5Mg/(Mg/[5 cm]) = 25cm.
Thus the new length is 1m + 25cm = 1.25m