Submission #445448

#TimeUsernameProblemLanguageResultExecution timeMemory
445448blueComputer Network (BOI14_network)C++17
25 / 100
107 ms7344 KiB
#include "network.h" #include <vector> #include <iostream> using namespace std; int getDist(int x, int y) { if(x == y) return 0; else { int P = ping(x, y); // cerr << "returning " << P << " for " << x << ", " << y << "\n"; return P + 1; } } void findRoute(int N, int a, int b) { int distA[N+1]; for(int i = 1; i <= N; i++) distA[i] = getDist(a, i); vector<int> dist_list[N+1]; for(int i = 1; i <= N; i++) { dist_list[ distA[i] ].push_back(i); } for(int x = 1; x <= distA[b]; x++) { // cerr << "x = " << x << '\n'; for(int A:dist_list[ distA[a] + 1 ]) { if(getDist(A, b) == distA[b] - distA[A]) { // cerr << "travelling to " << A << '\n'; travelTo(A); a = A; break; } } } }

Compilation message (stderr)

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]
   48 |     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]
   51 |             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...