ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1603. Erudite

melkiy stop asking #3 WA - HINT here [7] // Problem 1603. Erudite 10 Mar 2009 07:20
To all of you who cannot overcome #3 !!!

All the suggestions about redundant '\n' and about that the dictionary may have repeated words have nothing to do with WA #3 (read condition carefully).

If you use any kind of backward tracking, be it recursion or DFS, check the "no luck" condition attentively. First i used checking the next letter to be '\0' at the beginning of my recursion function, and if so returned 'true'. This is wrong! You must make word-end check BEFORE you make the next step, otherwise you may get "deadlock" "there is no direction to go" though there is no need to go anymore!!!

Test word for the example table
rabadaabracabrac: YES
(starting from [3,1] in C-like indices).
fuch_prog_er Re: stop asking #3 WA - HINT here // Problem 1603. Erudite 28 Mar 2009 21:36
How did you get rabadaabracabrac: YES
In the condition there is said,that words could not have self-intersections. But if you don't intersect you will not get this word.
My program writes NO on this test
Moonstone Re: stop asking #3 WA - HINT here // Problem 1603. Erudite 25 Jun 2010 13:43
Thank you, melkiy! I made the same mistake :(
TheDreamCatcher Re: stop asking #3 WA - HINT here // Problem 1603. Erudite 30 Nov 2010 07:42
My program got YES on this test, by have WA#3
Edgar Rokyan Re: stop asking #3 WA - HINT here // Problem 1603. Erudite 4 Oct 2011 23:48
Thanks!
BiteBoy [ONU] Re: stop asking #3 WA - HINT here // Problem 1603. Erudite 9 Oct 2011 17:26
Thanks a lot!
xpahos Re: stop asking #3 WA - HINT here // Problem 1603. Erudite 19 Apr 2016 02:42
It's not a test case for WA#3:

rabadaabracabrac: YES and it's not working.
PrankMaN Re: stop asking #3 WA - HINT here // Problem 1603. Erudite 10 May 2020 04:24
My reason for WA #3 was that I tried to use 1d char array to store the table and used i -> i - 1 to go left and i -> i + 1 to go right, however, if you are in the first column you can't go left and if you're on the 4th row you can't go right