Submission #480476

#TimeUsernameProblemLanguageResultExecution timeMemory
480476dsyzComputer Network (BOI14_network)C++17
100 / 100
114 ms7896 KiB
#include "network.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define MAXN (1005) void findRoute (int N, int a, int b){ int dist = ping(a, b); ll from[N + 1]; for(int i = 1;i <= N;i++){ if(i != a && i != b){ int fromend = ping(i,b); from[i] = fromend; } } int cur = a; int prev = dist; int visited[N + 1]; memset(visited,0,sizeof(visited)); visited[a] = 1; visited[b] = 1; for (int w = 0;w < dist;w++){ for(int i = 1;i <= N;i++){ if(i == a || i == b){ continue; } if(visited[i] == 0 && from[i] == prev - 1 && ping(cur,i) == 0){ visited[i] = 1; prev--; cur = i; break; } } travelTo(cur); } 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...