Submission #151877

# Submission time Handle Problem Language Result Execution time Memory
151877 2019-09-05T08:47:53 Z Ruxandra985 Computer Network (BOI14_network) C++14
25 / 100
116 ms 7976 KB
#include <cstdio>
#include "network.h"
void findRoute (int n,int a,int b){
    int da[n+1],f[n+1],tt[n+1],sol[n+1];
    int dq[n+1];
    int i,curr,elem,p,u;
    for (i=1;i<=n;i++){
        if (i!=a)
            da[i] = ping (a,i);
        f[i] = 0;
        tt[i] = 0;
    }
    da[a] = -1;
    curr = a;
    p = 1;
    u = 0;
    dq[++u] = a;
    f[a] = 1;
    while (p<=u){
        curr = dq[p];
        p++;
        for (i=1;i<=n;i++){
            if (i!=curr && !f[i] && da[i] == da[curr] + 1 && ping(curr,i) == 0){
                tt[i] = curr;
                f[i] = 1;
                dq[++u] = i;
            }
        }
    }
    curr = b;
    elem = 0;
    while (curr){
        sol[++elem] = curr;
        curr = tt[curr];
    }
    for (i=elem-1;i;i--)
        travelTo(sol[i]);

}

Compilation message

grader.c: In function 'int main()':
grader.c:48:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d%d%d%d", &N, &a, &b, &M);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
grader.c:51:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 116 ms 4216 KB Output is correct
2 Incorrect 112 ms 4216 KB Too many calls to ping
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 107 ms 4356 KB Output is correct
2 Correct 27 ms 2936 KB Output is correct
3 Correct 116 ms 7896 KB Output is correct
4 Correct 100 ms 6212 KB Output is correct
5 Correct 116 ms 7976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 105 ms 4216 KB Too many calls to ping
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 4248 KB Too many calls to ping
2 Halted 0 ms 0 KB -