답안 #300962

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
300962 2020-09-17T15:32:01 Z zecookiez 컴퓨터 네트워크 (BOI14_network) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
template<class C>constexpr int len(const C&c){return int(c.size());}

const int MAXN = 1001;
vector<int> dist[MAXN];

void findRoute(int N, int a, int b){
    int c = ping(a, b); dist[c].push_back(b);
    for(int v, i = 1; i <= N; ++i){
        if(i == a) continue;
        v = i == b ? c : ping(a, i);
        if(v < c) dist[v].push_back(i);
    }
    int prev = a;
    for(int x = 0; x < c; ++x){
        for(int nxt : dist[x]){
            if(x + 1 + ping(nxt, b) == c){
                travelTo(nxt); prev = nxt;
                break;
            }
        }
    }
    travelTo(b);
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:9:13: error: 'ping' was not declared in this scope
    9 |     int c = ping(a, b); dist[c].push_back(b);
      |             ^~~~
network.cpp:19:17: error: 'travelTo' was not declared in this scope
   19 |                 travelTo(nxt); prev = nxt;
      |                 ^~~~~~~~
network.cpp:24:5: error: 'travelTo' was not declared in this scope
   24 |     travelTo(b);
      |     ^~~~~~~~
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]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~