Submission #1236713

#TimeUsernameProblemLanguageResultExecution timeMemory
1236713nickolasarapidisRace (IOI11_race)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define F first #define S second const int MAXN = 200000; int k, ans = MAXN + 5; vector<pair<int, int>> adj[MAXN]; map<int, int> m[MAXN]; void dfs(int s, int e, int d1, int d2){ m[s][d2] = d1; for(auto a : adj[s]){ int u = a.F, w = a.S; if(u == e) continue; dfs(u, s, d1 + 1, d2 + w); if(m[u].size() > m[s].size()) swap(m[u], m[s]); for(auto x : m[u]){ if(m[s].count(2*d2 + k - x.F)) ans = min(ans, m[s][2*d2 + k - x.F] + x.S - 2*d1); } for(auto x : m[u]){ if(m[s].count(x.F)) m[s][x.F] = min(m[s][x.F], x.S); else m[s][x.F] = x.S; } } } int best_path(int N, int K, vector<vector<int>> H, vector<int> L){ for(int i = 0; i < N - 1; i++){ adj[H[i][0]].push_back({H[i][1], L[i]}); adj[H[i][1]].push_back({H[i][0], L[i]}); } k = K; dfs(0, -1, 0, 0); if(ans != MAXN + 5) return ans; return -1; }

Compilation message (stderr)

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