My dictionary says deserve means to get something as a right for our behaviour or effort. Going by the meaning I doubt the appropriateness of the word here. The teacher would have found it all right if her statement had the effect of this one: No sin can get such a punishment.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
Bruno Mendes"No one deserves it".I assume that in context the reader would be able to see that this meant No one deserves to be treated like this. The sentence may have been used in a strange way within the context of the sentences that came before it. As an isolated sentence it's not really ungrammatical, though most people would say "this" or "that