let the mass of lighter and heavier block be m and 2m respectively....
for block m
T-mg=ma................1
for block 2m
2mg-T=2ma...............2
adding 1 and 2
3ma=mg and T=4ma..........1
accleration of both blocks is same so displament after 1 sec for both will be equal
d=ut+at^2/2 (u=0 and t=1s)
d=a/2
lighter block will be displaced upward and heavier block is displaced downward so total potential energy
stored is PE= 2mgd + mg(-d)
=mgd..............2