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 1752. Tree 2

Why WA5? The code is here:
Posted by Harhro94 [Hrayr Harutyunyan] 25 Apr 2013 16:59
I have tested this code many times, it answers to all my tests correctly.

UPD: AC now !!!
Bug was here:
    for (i = 1; i <= n; ++i)
    {
        for (j = 1; j < POW; ++j)
        {
            up[i][j]=up[up[i][j - 1]][j - 1];
        }
    }
must be:
    for (j = 1; j < POW; ++j)
    {
        for (i = 1; i <= n; ++i)
        {
            up[i][j]=up[up[i][j - 1]][j - 1];
        }
    }


Edited by author 25.04.2013 18:21