Welcome all to the next Codeforces Format round!
In this round I will replace Artem Rakhov in his usual role of contest administrator: Artem have set out to America to take part in TopCoder Open Algorithm onsite. Good luck, Artem!
The contest has ended, results.
User a4461497 has won the contest, while among first-division users - kuniavski was the first who solved all 5 problems.
All tests to the contest problems:
To RAD.: best of luck in Las Vegas!
Maybe your array is too small,and that's my problem
Actually ,you can download the tests in the part for round #34 in home page
Thanks.
Input:
6 2 4
6 1 2 4 2
And how to know what value is i for each p(index)?
Maybe my question is dumb, but i really can't imagine this. :/
City parent City (p index)
1 6
3 1
4 2
5 4
6 2
City 2 has no parent since its the root.. (assign the parents sequentially to the cities from 1 to n, when city r1 comes do not assign any parent to it..)
The tree (Adjacency List) would look something like this:
1 : 6 - 3
2 : 4 - 6
3 : 1
4 : 2 - 5
5 : 4
6 : 1 - 2
Hope this makes things clear.. :)
__2__
| |
6 4
| |
1 5
|
3