On my book the statement of Weierstrass theorem is: If $f$ is a continuous function $f:A\subseteq X\rightarrow \mathbb{R}$ defined on a compact set $C$, where $A$ is the domain of $f$ and $X$ is a metric space, then argmax$f$ and argmin$f$ are non-empty and compact sets.
I have a couple of proof to demonstrate that argmin and argmax are nonempty but I cannot understand why they are also compact sets.
Have you any hint/proof to see that?
Thus, Argmin$(f)$ and Argmax$(f)$ are compact.