1. Close, but not quite.(The most commonly used one)
2. Fall just short of a successful outcome and get nothing for your efforts.
Origin: The phrase, and its variant 'nice try, but no cigar', are of US origin and date from the mid-20th century. Fairground stalls gave out cigars as prizes, and this is the most likely source, although there's no definitive evidence to prove that.
Good guy: I've finally solved your riddle! It's 52!
Bad guy: Close but no cigarre! It's 68!
Good guy: You bastard!