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 1329. Galactic History

WA 14
Posted by Alexander Prudaev 2 Oct 2006 21:50
please help, give me some exemples
if
descendant(A,B)==true, if A is descendant for B
int level(int X) == level of vertex with number X,
level(root)==0

my code:
...

    for (i=0;i<L;i++)
    {
        int a,b;
        scanf("%i %i",&a,&b);
        if (a==b){printf("0\n");continue;}
        if (level(a)<level(b))
        {
            if (descendant(b,a)) printf("1\n");
            else printf("0\n");
        }
        else
        {
            if (descendant(a,b)) printf("2\n");
            else printf("0\n");
        }
    }

WHY I got WA14?
please help me