답안 #42648

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42648 2018-03-01T20:28:58 Z BlackFlag777 컴퓨터 네트워크 (BOI14_network) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
void travelto(int k);
void findroute(int N, int a, int b);
int ping (int i, int j);
void findroute(int N, int a, int b)
{
    vector<int>v[1003];
    int par[1003],vis[1003];
    for(int i=1; i<=N; i++)
    {
        for(int j=1; j<=N; j++)
        {
            if(i!=j)
            {
                if(ping(i,j)==0)
                {
                    v[i].push_back(j);
                    v[j].push_back(i);
                }

            }
        }
    }
    queue<int>q;
    par[a]=-1;
    q.push(a);
    while(!q.empty())
    {
        int p=q.front();
        q.pop();
        if(vis[p])continue;
        vis[p]=1;
        for(int i=0;i<v[p].size();i++)
        {
            if(!par[v[p][i]]&&par[v[p][i]]!=-1)
            {
                par[v[p][i]]=p;
                q.push(v[p][i]);
            }
        }
    }
    vector<int>ans;
    int temp=b;
    while(1)
    {
        ans.push_back(temp);
        temp=par[temp];
        if(par[temp]==-1)break;
    }
    reverse(ans.begin(),ans.end());
    for(int i=0;i<ans.size();i++)
    {
        travelto(ans[i]);

    }
    return ;
}

Compilation message

network.cpp: In function 'void findroute(int, int, int)':
network.cpp:34:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<v[p].size();i++)
                      ^
network.cpp:52:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<ans.size();i++)
                  ^
grader.c: In function 'int main()':
grader.c:48:39: 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:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
                                         ^
/tmp/ccmuoiPH.o: In function `findroute(int, int, int)':
network.cpp:(.text+0x624): undefined reference to `travelto(int)'
/tmp/ccHXyXCd.o: In function `main':
grader.c:(.text.startup+0x9f): undefined reference to `findRoute(int, int, int)'
collect2: error: ld returned 1 exit status