Submission #1314889

#TimeUsernameProblemLanguageResultExecution timeMemory
1314889shangbinComputer Network (BOI14_network)C++20
100 / 100
54 ms4300 KiB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e3 + 5;
int dist[maxn];

void findRoute(int N, int a, int b){
    vector<int> spath;
    for (int i = 1; i <= N; i++){
        if (i != a) dist[i] = ping(a, i) + 1;
    }
    for (int cur_node = b; cur_node != a;){
        spath.push_back(cur_node);
        for (int i = 1; i <= N; i++){
            if (dist[i] == dist[cur_node] - 1 && ping(cur_node, i) == 0){
                cur_node = i;
                break;
            }
        }
    }
    int i = spath.end() - spath.begin();
    while (i--) travelTo(spath[i]);
}

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