At maximum compression velocity of the all the blocks is the same.
Applying conservation of momentum,
mv + 2mv = 4mv1 + mv [velocity of the rear mass does not change immediately as it is connected with the spring and v1 is the velocity of block B after collision]
3mv-mv - 4mv1
v1 = v/2
i) hence velocity of the block B after collision = v/2
appling momentum conservation just before collision and at the time of maximum compression
mv + 2mv = 5m x v2 [ where v2 is the velocity of the COM of system of blocks
A , B and C]
ii) v2 = 3v/5
the velocity of the COM of system of blocks A , B and C = 3v/5
iii) Applying conservation of energy at the intial moment that is just after collision and at the time of maximum compression,
1/2 mv2 + 1/2*4mv12 = 1/2*5mv22 +1/2kx2
1/2 mv2 + 1/2*4m*v2/4 = 1/2*5m*9/25v2 + 1/2kx2
mv2 (1+1 - 45/25) = 1/2 kx2
mv2 * 1/5 = 1/2 kx2
mv2 = 5kx2
x2 = mv2/5k
x = √(mv2/5k)