Submission #5977

# Submission time Handle Problem Language Result Execution time Memory
5977 2014-06-08T11:28:59 Z baneling100 Computer Network (BOI14_network) C++
50 / 100
124 ms 5076 KB
#include "network.h"

int Ans[1001], Dist;

int findBottom(int x)
{
    int i;

    for(i=x ; i>=0 ; i--)
        if(Ans[i])
            return i;
    return 0;
}

int findTop(int x)
{
    int i;

    for(i=x ; i<=Dist+1 ; i++)
        if(Ans[i])
            return i;
    return 0;
}

void findRoute (int N, int a, int b)
{
    int i, x, y, c, d;

    Dist=ping(a,b);
    Ans[0]=a;
    Ans[Dist+1]=b;
    for(i=1 ; i<=N ; i++)
        if(i!=a && i!=b)
        {
            x=ping(a,i);
            if(Ans[x+1]==0)
            {
                c=findBottom(x);
                d=findTop(x+2);
                if(c==0)
                {
                    if(d-x-2==ping(i,Ans[d]))
                        Ans[x+1]=i;
                }
                else
                    if(x-c==ping(Ans[c],i) && d-x-2==ping(i,Ans[d]))
                        Ans[x+1]=i;
            }
        }
    for(i=1 ; i<=Dist+1 ; i++)
        travelTo(Ans[i]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 5076 KB Output isn't correct - Too many calls to ping
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 108 ms 5076 KB Output is correct
2 Correct 28 ms 5076 KB Output is correct
3 Correct 112 ms 5076 KB Output is correct
4 Correct 112 ms 5076 KB Output is correct
5 Correct 124 ms 5076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 100 ms 5076 KB Output is correct
2 Correct 28 ms 5076 KB Output is correct
3 Correct 116 ms 5076 KB Output is correct
4 Correct 92 ms 5076 KB Output is correct
5 Correct 112 ms 5076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 5076 KB Output is correct
2 Correct 28 ms 5076 KB Output is correct
3 Incorrect 120 ms 5076 KB Output isn't correct - Too many calls to ping
4 Halted 0 ms 0 KB -