Submission #151896

# Submission time Handle Problem Language Result Execution time Memory
151896 2019-09-05T11:33:26 Z Ruxandra985 Computer Network (BOI14_network) C++14
100 / 100
115 ms 4816 KB
#include <cstdio>
#include "network.h"

void findRoute (int n,int a,int b){
    int db[n+1];
    int i,curr,nxt;
    for (i=1;i<=n;i++){
        if (i!=b)
            db[i] = ping(b,i);
    }
    curr = a;
    db[b] = -1;
    while (curr!=b){
 		for (i=1;i<=n;i++){
            if (db[i]+1 == db[curr] && ping(i,curr) == 0){
                nxt = i;
                break;
            }
 		}

        travelTo(nxt);
        curr = nxt;
    }

}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:13:16: warning: 'nxt' may be used uninitialized in this function [-Wmaybe-uninitialized]
     while (curr!=b){
            ~~~~^~~
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 113 ms 4600 KB Output is correct
2 Correct 110 ms 4600 KB Output is correct
3 Correct 101 ms 4684 KB Output is correct
4 Correct 100 ms 4600 KB Output is correct
5 Correct 100 ms 4600 KB Output is correct
6 Correct 100 ms 4592 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 4600 KB Output is correct
2 Correct 27 ms 2680 KB Output is correct
3 Correct 113 ms 4600 KB Output is correct
4 Correct 92 ms 4600 KB Output is correct
5 Correct 111 ms 4600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 4600 KB Output is correct
2 Correct 27 ms 2680 KB Output is correct
3 Correct 114 ms 4576 KB Output is correct
4 Correct 92 ms 4548 KB Output is correct
5 Correct 112 ms 4572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 105 ms 4620 KB Output is correct
2 Correct 27 ms 2808 KB Output is correct
3 Correct 115 ms 4728 KB Output is correct
4 Correct 95 ms 4728 KB Output is correct
5 Correct 113 ms 4816 KB Output is correct