If $Y$ is $T_1$, then all sets $\\{a\\}$ for $a \in Y$ are closed subsets, so $f^{-1}[\\{a\\}]$ is closed as the inverse image of a closed set under a continuous function.
If there is some $a_0 \in Y$ such that $f^{-1}[\\{a_0\\}]$ is non-empty and open, and if $X$ is connected, then $f^{-1}[\\{a_0\\}]$ is closed, open and non-empty, and in a connected space this means that $f^{-1}[\\{a_0\\}] = X$ (otherwise the set and its complement disconnect $X$!). And this in turn is equivalent to $f$ being constant (with value $a_0$). Note that then all $f^{-1}[\\{a\\}]$ are open, as for $a \
eq a_0$ the set is just the (open) empty set. (And if all inverse images of singletons are open, one of them at least is non-empty, and the previous applies).