A map is continuous if and only if the restrictions are
Use the definition : $f$ is continuous if and only if $f^{-1}(V)$ is open for any $V$ open set (and using the fact that the topology on a subset $T$ of $X$ is defined by all the $V\cap T$ where $V$ is a open set of $X$).
It is easy to verify that $$f_{|T}^{-1}(V)=\{T\cap f_{|T}^{-1}(V)\} $$
So, if $f$ is continuous, $f_{|A}$ and $f_{|B}$ are continuous.
Without further assumption on $A$ and $B$, the converse is false (cf. the other comment for a counter example).
Let $f(x) = 0$ if $x \neq 0$ and $f(0) = 1$. Then $f$ is obviously not continuous with respect to the usual topology on $\mathbb R$. Futher one can write $\mathbb R = A \cup B$ with $A = \mathbb R \setminus \{0\}$ and $B = \{0\}$. Though the restrictions $f_A$ and $f_B$ are continuous. Hence the assertion above doensn't hold :)
Nonetheless you can show that restrictions of continuous functions are indeed continuous again with the approach that Netchaiev gave.
It is not true as it stands, take any subset $A$ of the real line, standard topology, and consider the indicator function on $A$. This is continuous (constant) on the restriction to $A$ and its complement, respectively.