제출 #940217

#제출 시각아이디문제언어결과실행 시간메모리
940217ezzzay경주 (Race) (IOI11_race)C++14
컴파일 에러
0 ms0 KiB
#include "race.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define ff first
#define ll long long
#define ss second
const int M=2e5+5;
ll ans=INT_MAX;
vector<pair<ll,ll>>v[M];

bool vis[M];
ll Z;
vector<ll> fun(ll a){
	vis[a]=1;
	
    vector<ll>dp(150);
	for(ll i=0;i<=Z;i++)dp[i]=INT_MAX;
	dp[0]=0;
	for(auto p:v[a]){
		ll b=p.ff;
		ll c=p.ss;
		if(vis[b]==0){
			vector<int>vc=fun(b);
			for(ll i=0;i<=Z;i++){
				ans=min(ans,dp[i]+vc[Z-i]+2);
			}
			for(int i=0;i<=Z-c;i++){
				dp[i+c]=min(dp[i+c],vc[i]+1);
			}
		}
	}
	ans=min(ans,dp[Z]);
	return dp;
	
}
int best_path(int N, int K, int H[][2], int L[]){
	Z=K;
    for(int i=0;i<N-1;i++)cin>>H[i][0]>>H[i][1];
	for(int i=0;i<N-1;i++)cin>>L[i];
	for(int i=0;i<N-1;i++){
		int a=H[i][0];
		int b=H[i][1];
		int c=L[i];
		v[a].pb({b,c});
		v[b].pb({a,c});
	}
	
	fun(0);
	if(ans==INT_MAX)return -1;
	return ans;
}

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

/usr/bin/ld: /tmp/ccFxOoKS.o: in function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `best_path(int, int, int (*) [2], int*)'
collect2: error: ld returned 1 exit status