Submission #413045

#TimeUsernameProblemLanguageResultExecution timeMemory
413045ngpin04Race (IOI11_race)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "race.h" #include "grader.cpp" #define fi first #define se second #define mp make_pair using namespace std; const int Nmax = 2e5 + 5; vector <pair <int, int>> adj[Nmax]; map <int, int> s[Nmax]; int k, ans = 1e9; void dfs(int u, int p) { s[u][0] = 0; for (pair <int, int> e : adj[u]){ int v = e.fi; int w = e.se; if (v == p) continue; dfs(v, u); if (s[u].size() < s[v].size()) swap(s[u], s[v]); for (pair <int, int> pir : s[v]) if (s[u].count(k - pir.fi - w)) ans = min(ans, s[u][k - pir.fi - w] + pir.se + 1); for (pair <int, int> pir : s[v]) if (pir.fi + w <= k) { if (!s[u].count(pir.fi + w)) s[u][pir.fi + w] = pir.se + 1; else s[u][pir.fi + w] = min(s[u][pir.fi + w], pir.se + 1); } } } int best_path(int N, int K, int H[][2], int L[]) { k = K; for (int i = 0; i < N - 1; i++) { int u = H[i][0]; int v = H[i][1]; adj[u].push_back(mp(v, L[i])); adj[v].push_back(mp(u, L[i])); } dfs(1, -1); if (ans == 1e9) ans = -1; return ans; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccRaUNwm.o: in function `read_input()':
race.cpp:(.text+0x280): multiple definition of `read_input()'; /tmp/ccKMOqjm.o:grader.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccRaUNwm.o: in function `main':
race.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccKMOqjm.o:grader.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status