If the blocks are pulled by the same force, the suddenly move with an acce and instantaneously stop at any instant.
x 1 , x 2 be the extensions by block m1 and m2]
F (x 1 + x 2) = ½ (x 1 + x 2) 2
x 1 + x 2 = 2F / k
Also m 1 x 1 = m 2 x 2
x 1 + x 2 = 2F/k
x 1 + m 1/ m 2 x 1 = 2F/k
x 1 = 2F m 2 / k (m 1 + m 2)................................ANS
x 2 = 2F m 1/ k (m1 +m2).....................................ANS
HOPE U GOT IT...