I'm trying to solve this problem but I'm really stuck and it would be nice if someone can explain me proof or any hint for this problem.
Let $X \subset\mathbb R^N$ be a nonempty compact set, and $f: X \rightarrow\mathbb R$ a continuous function. Show that
$\operatorname{argmax}\limits_{x\in X}f(x) = \{ x \in X \mid f(x) \ge f(y) \text{ for all } y \in X\}$ is a compact set
Since $X$ is compact, the image in $\mathbf{R}$ is compact (as $f$ is continuous). Let $y$ be the maximum of the image of $f$.
Then $f^{-1}(y)$ is a closed set in a compact space, hence compact.