Consider an outer semicontinuous set-valued mapping $S: \mathbb{R}^n \rightrightarrows \mathbb{R}^m$.
(Namely the sets $S(x) \subseteq \mathbb{R}^m$ do not "change continuously" as a function of $x$)
1) Find a continuous function $f: \mathbb{R}^n \times \mathbb{R}^m \rightarrow \mathbb{R}_{\geq 0}$ such that
$f(x,y) = 0 \Longleftrightarrow y \in S(x) $
2) Can we make $f$ such that $\lim_{|(x,u)| \rightarrow \infty} f(x,y) = \infty$?
For instance the Euclidean distance of $y$ to the set $S(x)$, i.e. $f(x,y) = |y|_{S(x)}$, satisfies the property but it is not continuous.
Note: definition of outer semicontinuity for a set-valued map:
A set-valued mapping $S: \mathbb{R}^n \rightrightarrows \mathbb{R}^m $ is outer semicontinuous at $\bar x$ if
$ \limsup_{x \rightarrow \bar x} S(x) \subset S(\bar x) $
or equivalently $\limsup_{x \rightarrow \bar x} S(x) = S(\bar x)$.