508 - Morse Mismatches

All about problems in Volume 5. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
HelpDz
New poster
Posts: 1
Joined: Tue Dec 07, 2010 3:04 am

508 - Morse Mismatches

Post by HelpDz » Tue Dec 07, 2010 3:10 am

Hi all.....

Could some one plz help me in this problem, like some useful hints in solving this problem
just to get me started


thanx in advance

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 508 Morse Mismatches

Post by brianfry713 » Thu Nov 07, 2013 6:37 am

I first map each character to it's string encoding in the Morse code table.

Then I encode each word in the context section one letter at a time to build a Morse code string. If that Morse code word is unique, I store it in another map. If it is not unique, I add a "!" to the end of the existing word in that map if it doesn't already have one.

For each Morse word I search for it in the map. If it can't be found I search for the closest match and append a "?".

My code is straightforward.
Check input and AC output for thousands of problems on uDebug!

metaphysis
Experienced poster
Posts: 136
Joined: Wed May 18, 2011 3:04 pm

Re: 508 - Morse Mismatches

Post by metaphysis » Tue Apr 25, 2017 10:10 am

The description of problem needs fix.
It said that:
"If multiple context words match morse perfectly, then select the matching word with the fewest characters.
If this still results in an ambiguous match, any of these matches may be displayed. If multiple context
words exist for a given morse, the first matching word will be displayed followed by an exclamation
point (‘!’)."
Indeed, the judge only accept answer base one the latter rule, If you print the matching word with fewest characters, you will get WA.

20717TZ
New poster
Posts: 33
Joined: Tue Apr 27, 2004 7:41 pm
Location: Santa Clara / Mountain View, CA, USA
Contact:

Re: 508 - Morse Mismatches

Post by 20717TZ » Mon Jul 09, 2018 12:40 am

Indeed, that's what I got for the sample input, but my output is different from the sample output:

Code: Select all

WHAT
HATH
GOD
WROTH?
WHAT
AN
EARTHQUAKE
IM!
READY
TO
IM!
I Believe I Can - leestime.com

Post Reply

Return to “Volume 5 (500-599)”