Submission #65756

#TimeUsernameProblemLanguageResultExecution timeMemory
65756MiricaMateiComputer Network (BOI14_network)C++14
100 / 100
153 ms47976 KiB
#include "network.h" #include <bits/stdc++.h> using namespace std; vector<int>d[1005]; void findRoute (int N, int a, int b) { int dist; for (int i = 1; i <= N; ++i) { if (i == b) continue; int x = ping(b, i) + 1; if (i == a) dist = x; d[x].push_back(i); } d[0].push_back(b); while (a != b) { dist--; for (auto it:d[dist]) if (ping(it, a) == 0) { travelTo(it); a = it; break; } } }

Compilation message (stderr)

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:8:7: warning: 'dist' may be used uninitialized in this function [-Wmaybe-uninitialized]
   int dist;
       ^~~~
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...