Hello, I am trying to solve the puzzle and I can not pass tests 5 and 4.
For test 5 I get the answer:
trying to hack
Are you listening Automaton2000?
And here Automaton 2000?
And here Automaton 2000?
And here Automaton 2000?,
witch seems consistent with the puzzle statement.
For test 4 I get:
one two one two one two,
which also seems logical, since the depth of the tree should not exceed the number of words in a sentence in this case. I do not see how you can get into infinite loop from here.
Surely, I am missing something in the description of the puzzle.
Thanks for your feedback.
Thanks for replying.
Can you sketch a short example of the tree is this case? As I understand it, the moment an end node is encountered, a line should be printed, so you go down the tree to reconstruct the whole sentence, which is âone two one two one twoâ, where the last âtwoâ is the end node.
For test case 5 I still do not see why the output is wrong - there are 5 strings that contain or are âAutomaton2000â, so five lines are printed in the solution, and they seem to be the right ones following the logic of how the tree is updated.
What am I missing?
I was also wondering how does the test 4 expect âinfiniteâ sentence. But this answer clarifies the problem a bit. Maybe the better term should be âdirected graphâ instead of âtree that can be recursiveâ. The last one sounds like oxymoron to me
Am I the only one to have been confused by the fact that the statement talks about a tree (10 occurrences) while itâs actually a directed graph (corresponding to a Markov chain)?
Also, I really donât see the point of having added some spaces between the login and the â:â at the beginning of the chat lines in some testcases.
@nicola1: Yeah (+ connected to be accurate) but there are loops in this case, thatâs precisely the reason why the statement says âAutomaton2000 has a security and stops at 30 words at maximum. You donât want to do an infinite loop !â
@Kirbiby: Maybe, nevertheless this problem has only been solved by 112 people in almost two years while itâs not that difficult.
I think the confusion arises because the puzzle statement states that:
Everytime you read the word Automaton2000 in a sentence, you have to print a sentence.
So it sounds like that one sentence should be output whenever âAutomaton2000â is mentioned. For example, three sentences if mentioned three times even in a single chat line.
However, the output requirement states that:
One line each time a chat line contains the string Automaton2000
This implies that only one sentence should output even if âAutomaton2000â is mentioned a few times in a single chat line.
The latter interpretation is the one adopted in the puzzle.