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

To admins.
Posted by -AlexandeR- (TNU) 28 Aug 2009 02:01
This code with unitialised 'root' got crash on 10 test:

    int root;// = 0;
    for (i = 0; i < g.size(); ++i)
        if (g[i].size() == 1)
        {
            root = i;
            break;
        }
where g[i] - vector of adjacent vertices for i-th vertex.
So, graph in 10 test isn't tree.
You are wrong. Graph in the 10th test is a tree. (-)
Posted by Sandro (USU) 28 Aug 2009 02:16
Re: You are wrong. Graph in the 10th test is a tree. (-)
Posted by -AlexandeR- (TNU) 28 Aug 2009 02:29
Sorry :) I forgot about unique vertex.