답안 #151875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151875 2019-09-05T08:45:18 Z Ruxandra985 컴퓨터 네트워크 (BOI14_network) C++14
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include "network.h"
void findRoute (int n,int a,int b){
    int da[n+1],f[n+1],tt[n+1],sol[n+1];
    deque <int> dq;
    int i,curr,elem;
    for (i=1;i<=n;i++){
        if (i!=a)
            da[i] = ping (a,i);
        f[i] = 0;
        tt[i] = 0;
    }
    da[a] = -1;
    curr = a;
    dq.push_back(a);
    f[a] = 1;
    while (!dq.empty()){
        curr = dq.front();
        dq.pop_front();
        for (i=1;i<=n;i++){
            if (i!=curr && !f[i] && da[i] == da[curr] + 1 && ping(curr,i) == 0){
                tt[i] = curr;
                f[i] = 1;
                dq.push_back(i);
            }
        }
    }
    curr = b;
    elem = 0;
    while (curr){
        sol[++elem] = curr;
        curr = tt[curr];
    }
    for (i=elem-1;i;i--)
        travelTo(sol[i]);

}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:5:5: error: 'deque' was not declared in this scope
     deque <int> dq;
     ^~~~~
network.cpp:5:12: error: expected primary-expression before 'int'
     deque <int> dq;
            ^~~
network.cpp:15:5: error: 'dq' was not declared in this scope
     dq.push_back(a);
     ^~
network.cpp:15:5: note: suggested alternative: 'da'
     dq.push_back(a);
     ^~
     da
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]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~