Submission #467471

#TimeUsernameProblemLanguageResultExecution timeMemory
467471maeolaComputer Network (BOI14_network)C++17
100 / 100
102 ms7928 KiB
#include "network.h"
#include <bits/stdc++.h>

using namespace std;

void findRoute (int N, int a, int b)
{
    vector<int> Q(69 + N);
    vector<int> W[69 + N];
    for (int i = 1; i <= N; i++) {
        if(i == b) continue;
        Q[i] = ping(b, i);
        W[Q[i]].push_back(i);
    }

    int dist = Q[a] - 1;
    int cur = a;

    while(dist >= 0) {
        int chosen = -1;
        for (int x : W[dist]) {
            if(ping(cur, x) == 0)
                chosen = x;
        }
        travelTo(chosen);
        cur = chosen;
        dist--;
    }
    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...