1

Topic: Hare

In small fit there lives a hare. Jumping out of a hole and running on snow, it left traces. To define where there is a hare. The input data the Card of driving of a hare is set N (1<=N<=100) by lines which contain sequence of capital Latin letters the first letter whence the following where. Output data Deduce sequence of letters in a column in ascending order which specify a possible location of a hare if the card cannot be driving of a hare to deduce NO SOLUTION. An example 10 B C D K M A C D K L D L R K L Q N M M N A A P N N P Q P R L L R R P Answer B L the Question, whether the understanding of an example that is correct: 1) the way part is B-> C-> D-> K-> M-> A-> P-> R-> L-> Q-> N | |--------------- 2) "Deduce sequence of letters... In ascending order" - means, what topological sorting where L receives smaller number, than And though both peaks are in one cycle beforehand is fulfilled? 3) NO SOLUTION - the answer when there is no way on which it is possible to transit all peaks (in an example - quitting from In it is possible to visit all peaks)?

2

Re: Hare

Hello, olimp_20, you wrote: _> the Example _> 10 _> B C D K M A _> C D K L _> D L R _> K L Q N M _> M N A _> A P N _> N P _> Q P R L _> L R _> R P _> the Answer _> B _> L Similar here is described the graph. Anlijsky letters - peaks. Each line is a list of edges,  from peak which costs in the beginning of a line. I.e. the line "M N A" means presence in the column of edges M-> N and M-> A Thus we can construct all graph. _> 2) "deduce sequence of letters... In ascending order" - means, what topological sorting where L receives smaller number, than And though both peaks are in one cycle beforehand is fulfilled? I think so: under the given graph it is necessary to define, whether it is possible to bypass the graph on all edges, transiting each edge it is strict one time. I.e. to define presence of the Euler way the End of such way and will be the answer. And also the way beginning if the graph is nondirectional. Or all peaks if there is an Euler cycle will be the answer. _> 3) NO SOLUTION - the answer when there is no way on which it is possible to transit all peaks (in an example - quitting from In it is possible to visit all peaks)? If the way is not present, NO SOLUTION

3

Re: Hare

Hello, the Corkcrew, you wrote: the End of such way also will be the answer. And also the way beginning if the graph is nondirectional. Thanks: that that the graph can be  - helped to understand an example.