Submission #559444

#TimeUsernameProblemLanguageResultExecution timeMemory
559444Sam_a17Computer Network (BOI14_network)C++14
100 / 100
95 ms7912 KiB
#include <bits/stdc++.h> #include "network.h" using namespace std; const int M = 1e3 + 10; vector<int> adj[M]; void findRoute (int N, int a, int b) { /* int dist = ping(a, b); for (int i = 1; i <= dist; ++i) travelTo(i); */ int maxi = ping(a, b); for(int i = 1; i <= N; i++) { if(i == a || i == b) { continue; } int dist = ping(i, b); if(dist < maxi) { adj[dist].push_back(i); } } int curr = a; for(int i = maxi - 1; i >= 0; i--) { for(auto j: adj[i]) { if(!ping(curr, j)) { travelTo(j); curr = j; break; } } } travelTo(b); }

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...