Solution (source code)

= Solution
{c}

An ideal <projective measurement> of the field's <photon number> selects the coefficient of $|1\rangle$. Therefore
$$
\boxed{P_1(t)=\frac13\sin^2(\sqrt6gt).}
$$
Whenever this probability is nonzero, normalization of the projected joint <quantum state> gives the atomic <Bell state>
$$
\boxed{|\psi_{\rm atoms}\rangle=\frac{|eg\rangle+|ge\rangle}{\sqrt2},}
$$
up to a common <global phase>. The maximum heralding probability is $1/3$, attained at $\sqrt6gt=\pi/2+n\pi$. At a time with $P_1=0$, that conditioning event is impossible, so a conditional state is not defined there. The interpretation is a <photon number> measurement at the selected time; continuous monitoring of escaping <photons> would instead change the dynamics and require a different model.