Discontinuous maps taking compacts to compacts It's commonly known that in general topology, a continuous map $f$ from a topological space $(X, \tau)$ to another topological space $(Y, \tau')$ will send every compact set to another compact set. Moreover, I'm aware that the converse does not hold, as so long as $\# Y \geq 2$, we can pick some set $S \subseteq X$ and define
$$f(x) = \begin{cases}
y_{1} & x \in S \\
y_{2} & x \in S^{\complement} .
\end{cases}$$
This would send not only compact sets to compact sets, but all sets to compact sets because $f(X)$ is finite, and thus compact (as are all its subsets). But this map could easily not be continuous.
NOTE: Understand for the rest of this post that $f: X \to Y$ is surjective.
My question is if there are more interesting counter-examples. Say $X = \mathbb{R}$ with the Euclidean metric; then what would be an example of such a discontinuous map $f: X \to Y$ where $Y = \mathbb{N}$ (with the usual metric), or $Y = \mathbb{Q}$ (again with the usual topology). What about $\mathbb{R}$, or $\mathbb{R} \setminus \mathbb{Q}$? Is there perhaps a limit on how large in cardinality $Y$ can be (with respect to $X$)? I'm curious to see less trivial counterexamples to the converse. Thanks!
EDIT: Many of the examples I'm getting still rely on compact sets having finite image. So a problem I might find more interesting: Can I construct a discontinuous counterexample where $f$ is also injective?
 A: You could define $f:\mathbb R\rightarrow\mathbb Z$ such that $f(x)=\lfloor x\rfloor$. Since every compact subset of the reals has only a finite number of integers in it, this sends compact sets to compact sets.
You could define $f:\mathbb R\rightarrow\mathbb Q$ be letting $f(x)$ be the closest member of the (compact) sequence $\{1/n\}\cup\{0\}$ (choose the larger element if there are two points of the sequence equidistant from $x$). This works because compact sets in the reals are closed.
You could define $f:\mathbb R\rightarrow\mathbb J$ where $J$ is the cantor set in a similar way: $f(x)$ is the closest member of the cantor set to $x$. This works again because the cantor set is compact.
A: Consider the identity map $i:\mathbb{R} \rightarrow \mathbb{R}'$, where the topology on the first $\mathbb{R}$ is the usual, and at $\mathbb{R}'$ you add to the usual topology the set $\{0\}$ with the necessary unions to make this family a topology. This is a bijection from a Haussdorf space to another, that carries every compact space to compact space (and moreover, inverse images of compact sets still being compact sets), and $f$ is not a continuous function, since $f^{-1}(\{0\})$ is not open in $\mathbb{R}$ (but $\{0\}$ is in $\mathbb{R}'$).
A fun fact: the topology at $\mathbb{R}'$ doesn't have the Heine-Borel property: for example the set $(0,1]$ is closed and limited, but it's not compact.
