제출 #493424

#제출 시각아이디문제언어결과실행 시간메모리
493424vendx_greyback자매 도시 (APIO20_swap)C++14
컴파일 에러
0 ms0 KiB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;

const int mxn = 1e5;
int par[mxn], mx = 0;
bool isLine = true;

int get(int u){
    
    if(u == par[u])
        return u;
        
    return par[u] = get(par[u]);
    
}

void join(int u, int v){
    
    u = get(u);
    v = get(v);
    
    par[u] = v;
    
}

void init(int n, int m, int u[], int v[], int w[]){
    
    for(int i = 0; i < n; i++)
        par[i] = i;
    
    for(int i = 0; i < m; i++){
        
        if(get(u[i]) == get(v[i]))
            isLine = false;
        
        else
            join(u[i], v[i]);
            
        mx = max(mx, w[i]);
        
    }
    
}

int getMinimumFuelCapacity(int x, int y){
    return (isLine? -1: mx);
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccybFEYF.o: in function `main':
grader.cpp:(.text.startup+0x1c3): undefined reference to `init(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status