Submission #151888

#TimeUsernameProblemLanguageResultExecution timeMemory
151888Ruxandra985Computer Network (BOI14_network)C++14
0 / 100
113 ms4316 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,nxt; for (i=1;i<=n;i++){ da[i] = db[i] = -2; } curr = a; x = -1; da[b] = db[a] = ping(a,b); y = da[b]; while (curr!=b){ int more = 0; for (i=1;i<=n;i++){ if (i!=curr){ if (da[i] == -2) da[i] = ping(a,i); if (da[i] == x + 1){ if (i == b) db[i] = -1; else { if (db[i] == -2) db[i] = ping(i,b); } if (y-1 == db[i]){ if (!more) nxt = i; else { if (curr == a || ping(curr,nxt)==0) break; else nxt = i; } more = 1; } } } } travelTo(nxt); curr = nxt; x++; y--; } }

Compilation message (stderr)

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:14: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...