Submission #151881

#TimeUsernameProblemLanguageResultExecution timeMemory
151881Ruxandra985Computer Network (BOI14_network)C++14
50 / 100
116 ms8072 KiB
#include <cstdio> #include "network.h" void findRoute (int n,int a,int b){ int da[n+1],db[n+1]; int i,curr,x,y,xn,yn,nxt; for (i=1;i<=n;i++){ if (i!=a) da[i] = ping (a,i); if (i!=b) db[i] = ping (b,i); } curr = a; x = -1; y = da[b]; while (curr!=b){ for (i=1;i<=n;i++){ if (i!=curr){ if (i!=b){ xn = da[i]; yn = db[i]; } else { xn = da[i]; yn = -1; } if (x+1 == xn && y-1 == yn && ping(curr,i)==0){ nxt = i; break; } } } travelTo(nxt); curr = nxt; x++; y--; } }

Compilation message (stderr)

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:16: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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...