Submission #713949

#TimeUsernameProblemLanguageResultExecution timeMemory
713949StickfishComputer Network (BOI14_network)C++17
100 / 100
110 ms7996 KiB
#include "network.h"
#include <vector>
using namespace std;

void findRoute (int N, int a, int b) {
    vector<int> depth(N + 1);
    vector<vector<int>> rdepth(N);
    for (int i = 1; i <= N; ++i) {
        if (i != b)
            depth[i] = ping(i, b) + 1;
        rdepth[depth[i]].push_back(i);
    }
    int v = a;
    while (v != b) {
        for (auto u : rdepth[depth[v] - 1]) {
            if (ping(v, u) + 1 == 1) {
                v = u;
                travelTo(v);
                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...