Regrettably: simply not possible with a game of skill.
If all you have is start time and end time, there is nothing stopping me from writing a script to start the puzzle, autosolve it, and submit the answer, all within milliseconds. IF you block submissions in milliseconds, I can just do a binary search upwards to find a time you will accept, and submit at that time instead.
If the puzzle has "moves" (for example, a sliding block puzzle, jigsaw puzzle, etc), then you can get some slight modicum of security by making the server validate each move, so that my solver then has to submit each required move to solve it. But there's no reason I can't do that.
You can add a few additional layers to the security onion by obfuscating your code, encrypting the communications, checksums, sending every mouseclick to detect nonhumans, detecting fake scores and showing them only to the faker so they don't know their faked score has been disallowed, etc... but ultimately, you need to display the puzzle to the user, and accept inputs from the user that can solve the puzzle, and that's all a solver script needs.
Macros like AutoHotkey or any keyboard and mouse hooking program will allow your solver script to read the screen and fake the keyboard and mouse input.
The only way, in gaming contests, to get someone to provably win without automated tools is to have them sit in front of you, with a machine and controller you provided them. That's why prize-money gaming events are usually done in person.
But there IS a way to make it fair anyway! Blind randomness with no advantage for time, and all gameplay moves handled by the server. So poker websites can work, because what cards you have and your AI opponent has are blindly random (so long as you don't do anything dumb like tell the client about any of the cards the payer cannot see). Once the basics of the statistics are known, you can't really play a game like poker any better with the help of a bot. Same with most other gambling games: slots, etc.
[Edit: As @Joshua points out in comments, the above is only true of single-player gambling, or multiplayer methods of gambling for which collusion between players cannot become just another form of trust-the-client vulnerability. I'm kinda surprised that anyone thought multiplayer online card games could possibly be secure.]
[And, of course, if there's money in it, make sure that your randomness REALLY IS random if you take that path. Just calling rand() and hoping ain't enough. If you can find a copy of Laura D Hamilton's seminal "When Random Isn't Random Enough: Lessons from an Online Poker Exploit", it's absolutely worth reading: I can't find it online any more, sadly.]