Let $a$ and $b$ be the accelerations of $A$ and $B$, respectively, and let $d$ be the length of the race. Let $x_A(t)$ and $x_B(t)$ be the distances covered by $A$ and $B$, respectively, at time $t$ after the start of the race; $x_A(t)=\frac12at^2$, and $x_B(t)=\frac12bt^2$. $A$ reaches the $3/4$ mark at time $t_1$ given by the equation $\frac34d=\frac12at_1^2\tag{1}$ and finishes the race at time $t_2$ given by the equation $d=\frac12at_2^2\;,\tag{2}$ and we’re told that $t_2-t_1=3$, so we can rewrite $(2)$ as $d=\frac12a(t_1+3)^2\tag{3}$ and solve $(1)$ and $(3)$ for $t_1$. Multiplying $(1)$ by $4/3$, we get $d=\frac23at_1^2\;,$ so
$\begin{align*} &\frac23at_1^2=\frac12a(t_1+3)^2\;,\\ &4t_1^2=3(t_1+3)^2=3t_1^2+18t_1+27\;,\\ &t_1^2-18t_1-27=0\;,\\ &t_1=\frac12(18\pm\sqrt{432})=9\pm 6\sqrt3\;, \end{align*}$
and since $3-6\sqrt3<0$, we must have $t_1=9+6\sqrt3$ and $t_2=12+6\sqrt3$.
Following the same procedure for $B$, starting with the system
$\left\{\begin{align*} &\frac23d=\frac12bt_3^2\\ &d=\frac12b(t_3+4)^2\;, \end{align*}\right.$
we get $3t_3^2=2(t_3+4)^2=2t_3^2+16t_3+32$, $t_3^2-16t_3-32=0$, $t_3=8+4\sqrt6$, and $t_3+4=12+4\sqrt6$.
Thus, $A$ finishes at time $12+6\sqrt3\approx 22.392$, and $B$ finishes at time $12+4\sqrt6\approx 21.798$. $B$ is the winner by $6\sqrt3-4\sqrt6=(6-4\sqrt2)\sqrt3\approx 0.343$ seconds.