Submission #218276

#TimeUsernameProblemLanguageResultExecution timeMemory
218276dolphingarlicComputer Network (BOI14_network)C++14
100 / 100
136 ms8068 KiB
#include "network.h"
#include <vector>

int dist[1001];
std::vector<int> from_b[1001];

void findRoute(int N, int a, int b) {
    for (int i = 1; i <= N; i++) {
        if (i == b) continue;
        dist[i] = ping(i, b);
        from_b[dist[i]].push_back(i);
    }

    for (int i = dist[a]; i; i--) {
        for (int j : from_b[i - 1]) if (!ping(a, j)) {
            travelTo(j);
            a = 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]
     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]
             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...