Solution (source code)

= Solution
{c}

If $f$ is continuous, the two sets are inverse images of the open rays $(-\infty,\lambda)$ and $(\lambda,\infty)$, so they are open. Conversely, suppose both families of inverse images are open. For any interval $(a,b)$,
$$
f^{-1}((a,b))=\{f>a\}\cap\{f<b\},
$$
which is open. By part (c)(i) and the <basis of a topology> criterion from part (b), all inverse images of open sets are open. Hence \b[$f$ is continuous].