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 1471. Distance in the Tree

andrei parvu test #5 [4] // Problem 1471. Distance in the Tree 17 Aug 2008 00:54
can anyone tell me what is the 'problem' with test #5, because I get stack overflow, although I don't declare any local variables in my recursive function (I use a vector to simulate the stack)
windhunter Re: test #5 [3] // Problem 1471. Distance in the Tree 18 May 2011 08:31
I have the same problem ,first!
but I find that test#5 may be not a tree!
for example:
3
0 1 1
1 0 1
1
0 1
so you should use array to record whether a node have been in the stack.
windhunter Re: test #5 [2] // Problem 1471. Distance in the Tree 18 May 2011 08:53
sorry:
the example is
4
0 1 1
1 2 1
2 0 1
1
0 1
BZz13 Re: test #5 // Problem 1471. Distance in the Tree 10 Jan 2017 14:55
But your example is not a tree... there are cicle...
Mescheryakov_Kirill [SESC17]💻 by Kirom Re: test #5 // Problem 1471. Distance in the Tree 22 Jan 2017 22:44
Ancorrect test