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

test #5
Posted by andrei parvu 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)
Re: test #5
Posted by windhunter 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.
Re: test #5
Posted by windhunter 18 May 2011 08:53
sorry:
the example is
4
0 1 1
1 2 1
2 0 1
1
0 1
Re: test #5
Posted by BZz13 10 Jan 2017 14:55
But your example is not a tree... there are cicle...
Re: test #5
Posted by Mescheryakov_Kirill [SESC17]💻 by Kirom 22 Jan 2017 22:44
Ancorrect test