QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#178507#2002. RaceModyKachef#Compile Error//C++20848b2023-09-14 01:55:512024-07-04 02:42:44

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 02:42:44]
  • 评测
  • [2023-09-14 01:55:51]
  • 提交

answer

#include <bits/stdc++.h>
#include "race.h"
using namespace std;
#define int long long
#define A first
#define B second
#define pii pair<int , int>
#define pb push_back

vector<vector<pii>> adj;
int n , k;
int dfs(int node , int par , int dep){
    if (dep == k) return 0;
    int ans = 1e18;
    for (auto i : adj[node]){
        if (i.A!=par){
            ans = min(ans , dfs(i.A , node , dep + i.B)+1);
        }
    }
    return ans;
}
int best_path(int N , int K , int H[][2] , int L[]){
    n = N; k = K;
    adj.resize(n+1);
    for (int i = 0 ; i<n-1 ; i++){
        adj[H[i][0]].pb({H[i][1] , L[i]});
        adj[H[i][1]].pb({H[i][0] , L[i]});
    }
    int ans = 1e18;
    for (int i = 1 ; i<=n ; i++){
        ans = min(ans , dfs(i , -1 , 0));
    }
    if (ans == 1e18) return -1;
    else return ans;
}

Details

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