Submission #397581

# Submission time Handle Problem Language Result Execution time Memory
397581 2021-05-02T12:30:16 Z lyc Computer Network (BOI14_network) C++14
0 / 100
107 ms 7876 KB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;

int _ping(int a, int b) {
    if (a == b) return -1;
    return ping(a,b);
}

void findRoute (int N, int a, int b)
{
    int dist[N+1];
    for (int i = 1; i <= N; ++i) {
        dist[i] = _ping(a,i);
    }

    vector<int> v = {b};
    for (int i = 1; i <= N; ++i) {
        if (dist[i] == dist[b]-1) {
            v.push_back(i);
            break;
        }
    }

    for (int d = dist[b-2]; d >= 0; --d) {
        for (int i = 1; i <= N; ++i) if (dist[i] == d && _ping(v.back(),i) == 0) {
            v.push_back(i);
            break;
        }
    }

    for (int i = (int)v.size()-1; i >= 0; --i) {
        travelTo(v[i]);
    }
}

Compilation message

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 time Memory Grader output
1 Incorrect 107 ms 7876 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 101 ms 6648 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 6608 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 101 ms 6656 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -