You can do it in linear time (which is asymptotically optimal).

Simply add a new vertex $s$ and all edges $(s,a)$ for $a \in A$. Then run a breadth first search from $s$ on the resulting graph while ignoring vertices in $C$  and check whether any of the reached vertices in in $B$.
This requires time $O(|V| + |E|)$.