Solution (source code)

= Solution

Split $Z_1,\ldots,Z_{mn}$ into $m$ blocks of size $n$. Compute the same Kolmogorov-Smirnov statistic against $F_0$ for the observed $X$ sample and for every $Z$ block. Under $H_0$ the $m+1$ statistics are exchangeable and, because the distribution is continuous, ties have probability zero. Reject exactly when the statistic from the $X$ sample is the largest. Its null rejection probability is exactly
$$
\boxed{\frac1{m+1}}.
$$