Submission #719298

#TimeUsernameProblemLanguageResultExecution timeMemory
719298Joshi503Race (IOI11_race)C++14
Compilation error
0 ms0 KiB
#include "race.h" #include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll using db = long double; using str = string; using pi = pair<int, int>; using pl = pair<ll, ll>; using pd = pair<db, db>; #define f first #define s second using vi = vector<int>; using vpi = vector<pi>; #define pb push_back #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = ((b)-1); i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define rep(a) F0R(_,a) #define each(a,x) for (auto& a: x) int test; /* */ int n, k; vi d; vector<vpi> adj; int mini; void dfs(int u, int p, int len = 1){ each(v, adj[u]){ if(v.f == p) continue; d[v.f] = d[u] + v.s; if(d[v.f] == k){ mini = min(mini, len); } dfs(v.f, u, len + 1); } } int best_path(int N, int K, int H[][2], int L[]){ adj = vector<vpi>(N + 1); n = N, k = K; F0R(i, N - 1){ int u = H[i][0], v = H[i][1]; adj[u].pb({v, L[i]}); adj[v].pb({u, L[i]}); } int ans = 1e18; F0R(i, N){ mini = 1e18; d = vi(N + 1, 0LL); dfs(i, -1); ans = min(mini, ans); } return (ans == 1e18 ? -1 : ans); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccyAZzTS.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