Submission #978564

#TimeUsernameProblemLanguageResultExecution timeMemory
978564LOLOLORace (IOI11_race)C++98
Compilation error
0 ms0 KiB
#include "race.h" #include <bits/stdc++.h> #define ll long long using namespace std; #define f first #define s second #define pb push_back #define ep emplace #define eb emplace_back #define lb lower_bound #define ub upper_bound #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin()) #define mem(f,x) memset(f , x , sizeof(f)) #define sz(x) (int)(x).size() #define __lcm(a, b) (1ll * ((a) / __gcd((a), (b))) * (b)) #define mxx *max_element #define mnn *min_element #define cntbit(x) __builtin_popcountll(x) #define len(x) (int)(x.length()) const int N = 1e6 + 10; vector <pair <int, int>> ed[N]; ll d1[N], d2[N], k; ll ans = 1e9; map <ll, int> mp[N]; // x + y - 2 * v = k // x + y = k + 2 * v void dfs(int u, int v) { mp[u][d1[u]] = d2[u]; ll tot = k + 2 * d1[u]; for (auto x : ed[u]) { if (x.f == v) continue; d2[x.f] = d2[u] + 1; d1[x.f] = d1[u] + x.s; dfs(x.f, u); if (sz(mp[u]) < sz(mp[x.f])) { swap(mp[u], mp[x.f]); } for (auto el : mp[x.f]) { auto it = mp[u].find(tot - el.f); if (it != mp[u].end()) { ans = min(ans, it -> s + el.s - d2[u] * 2); } } } } int best_path(int n, ll len, int H[][2], int L[]) { k = len; for (int i = 0; i < n - 1; i++) { ed[H[i][0]].pb({H[i][1], L[i]}); ed[H[i][1]].pb({H[i][0], L[i]}); } dfs(0, 0); if (ans > n) ans = -1; return ans; } int main() { }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccHUh8KL.o: in function `main':
race.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccZE1W0O.o:grader.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccZE1W0O.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