A similar situation occured to a prospective pilot on here a few years ago. He was attemting to gain a class2, and from memory, had only used cannabis (not coke).
I got some feedback from him some time later- he gained his class2, but had to have a sit down with a psychiatrist first,(At his own expense), in order to state he wasn't an "addict."
I'm not sure the position with class1 or with using cocaine. It may be worth a search as I think it may have been discussed before.
Without wishing to get into the morals of it all, I'm not sure it's a matter of punishment. The AME's are there to protect the public, not for the sake of your health.