Submission #1067032

#TimeUsernameProblemLanguageResultExecution timeMemory
1067032ThunnusRace (IOI11_race)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using i64 = long long; #define int i64 #define vi vector<int> #define vvi vector<vi> #define vb vector<bool> #define pii pair<int, int> #define fi first #define se second #define sz(x) (int)(x).size() const int MAXN = 2e5 + 5; int ans = LLONG_MAX, k; vector<map<int, int>> mp(MAXN); inline void dfs(vector<vector<pii>> &adj, int v = 0, int p = -1, int dist = 0, int dep = 0){ for(pii &u : adj[v]){ if(u.fi == p) continue; dfs(adj, u.fi, v, dist + u.se, dep + 1); if(sz(mp[u.fi]) > sz(mp[v])) mp[v].swap(mp[u.fi]); for(auto &it : mp[u.fi]){ if(mp[v].count(k - (it.fi - 2 * dist))){ // distance with lca ans = min(ans, mp[v][k - (it.fi - 2 * dist)] + it.se - 2 * dep); } } for(auto &it : mp[u.fi]){ if(!mp[v].count(it.fi)) mp[v][it.fi] = it.se; else mp[v][it.fi] = min(mp[v][it.fi], it.se); if(it.fi - dist == k){ ans = min(ans, it.se - dep); } } } mp[v][dist] = dep; } int best_path(int n, int K, int h[][2], int l[]){ k = K; vector<vector<pii>> adj(n); for(int i = 0; i < n; i++){ adj[h[i][0]].emplace_back(h[i][1], l[i]); adj[h[i][1]].emplace_back(h[i][0], l[i]); } dfs(adj); return (ans == LLONG_MAX ? -1 : ans); }

Compilation message (stderr)

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