답안 #96727

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96727 2019-02-11T15:10:50 Z MohamedAhmed0 꿈 (IOI13_dreaming) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX = 1e5 + 10 ;
vector< vector< pair<int,  int> > >adjlist(MAX) ;
int comp[MAX] ;
int cnt = 0 ;
void dfs(int node , int par)
{
    comp[node] = cnt ;
    for(auto &child : adjlist[node])
    {
        if(child.first != par)
            dfs(child.first , node) ;
    }
    return ;
}

int travelTime(int N,int M,int L,int A[],int B[],int T[])
{
    cnt = 0 ;
    for(int i = 0 ; i < M ; ++i)
    {
        int x = A[i] , y = B[i] , z = T[i] ;
        adjlist[x].push_back({y , z}) ;
        adjlist[y].push_back({x , z}) ;
    }
    for(int i = 1 ; i <= N ; ++i)
    {
        if(comp[i] == 0)
        {
            ++cnt ;
            dfs(i , i) ;
        }
    }
    if(cnt > 2)
        assert(true) ;
}

Compilation message

dreaming.cpp: In function 'int travelTime(int, int, int, int*, int*, int*)':
dreaming.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/tmp/ccmI0nxs.o: In function `main':
grader.c:(.text.startup+0xa2): undefined reference to `travelTime'
collect2: error: ld returned 1 exit status