What is the ratio of the acceleration in the two cases (a) and (b) What is the ratio of the acceleration in the two cases (a) and (b)?

I thought that the ratio would be 1:1 but it my textbook says its 1:3, so can someone explain to me how that's possible.
 A: $1)$ Let's make all the  forces that would be acting on the blocks, in the first case.                 
Now we apply newtons' laws of motion assuming that block of mass 2m accelerates downward with $a_1$ acceleration and the block of mass m accelerates upward with same magnitude of $a_1$ acceleration( because they are constrained to have same acceleration till the string is tight).
So,
\begin{align}
&2mg-T=2ma_1\qquad\quad\cdots (1)\\
&T-mg=ma_1\qquad\qquad\cdots (2)\\
\end{align}
adding (1) and (2),
$$\implies(2mg-T)+(T-mg)=2ma_1+ma_1$$
$$\implies mg=3ma_1$$
$$\implies a_1=\frac{g}{3}\qquad\qquad\cdots(3)$$
Thus, acceleration of block of mass m would be $\frac{g}{3}$ in upward direction.
$2)$ Now making the forces for the second one:

We assume that the string is ideal, and as we know that an ideal string is massless and inextensible, which means that the tension at any point through out the string should be constant, because if it is not constant then the net force at that point would not be zero and thus the string would have infinite acceleration being massless, therefore the downward force that you apply at the free end of the string should be equal to the tension at that point, which eventually gets transferred to the block and lifts it up.
Thus,
$$|\vec{T}|=|\vec{F}| = 2mg$$
Let's say that the block moves upward with $a_2$ acceleration.
$$T-mg = ma_2$$
$$\implies 2mg - mg = ma_2$$
$$\implies mg = ma_2$$
$$\implies a_2 = g$$
So you see that in this case the block of mass m has an upward acceleration equal to $g$, i.e. 3 times the acceleration in first case (refer equation 3)
Thus $$\frac{a_1}{a_2} = \frac{\frac{g}{3}}{g} = \frac{1}{3}$$
$$\implies a_1 : a_2 = 1: 3$$
