Let $f:A\rightarrow\Bbb R$, $A\subset\Bbb R$ and any $c \in \Bbb R $
If $E^-=\{x \in A :f(x)< c\}$ and $E^+=\{x\in A:f(x)>c\}$ are open sets, then $f:A\rightarrow \Bbb R$ is continuous.
Let $f:A\rightarrow\Bbb R$, $A\subset\Bbb R$ and any $c \in \Bbb R $
If $E^-=\{x \in A :f(x)< c\}$ and $E^+=\{x\in A:f(x)>c\}$ are open sets, then $f:A\rightarrow \Bbb R$ is continuous.
Let $a,b \in \mathbb{R}$ such that $a < b$.
$E^{+}_a = \{x \in A : f(x) > a\} = f^{-1}((a, \infty))$
and
$E^-_b = \{x \in A : f(x) < b\} = f^{-1}((-\infty, b))$
are open by the assumption. Hence
$f^{-1}((a,b)) = f^{-1}((a, \infty) \cap (-\infty, b)) = f^{-1}((a,\infty)) \cap f^{-1}((-\infty, b))$
is open. All open subset $U$ of $\mathbb{R}$ is a union of open sets of the form $(a,b)$. $f^{-1}(U)$ is open. The inverse image of any open set under $f$ is open. Hence $f$ is continuous.
Let $a, b \in \mathbb{R}$ such that $a < b$. Then $f^{-1}((a, b))$ is open by the assumption. Any open subset $U$ of $\mathbb{R}$ is a union of subsets of the form $(a, b)$. Hence $f^{-1}(U)$ is open. Hence $f$ is continuous.