Submission #349763

#TimeUsernameProblemLanguageResultExecution timeMemory
349763pavementRace (IOI11_race)C++17
Compilation error
0 ms0 KiB
#include "race.h" #include <bits/stdc++.h> using namespace std; int _K, ans = 1e9, dist[1000005], dep[1000005]; vector<pair<int, int> > adj[1000005]; set<pair<int, int> > S[1000005]; void dfs(int n, int e = -1) { S[n].emplace(dist[n], dep[n]); for (auto u : adj[n]) { if (u.first != e) { dist[u.first] = dist[n] + u.second; dep[u.first] = dep[n] + 1; dfs(u.first, n); if (S[n].size() < S[u.first].size()) swap(S[n], S[u.first]); for (auto i : S[u.first]) { auto it = S[n].lower_bound(make_pair(_K - i.first + 2 * dist[n], 0)); if (it != S[n].end() && it->first + i.first - 2 * dist[n] == K) ans = min(ans, it->second + i.second - 2 * dep[n]); } for (auto i : S[u.first]) S[n].insert(i); } } }

Compilation message (stderr)

race.cpp: In function 'void dfs(int, int)':
race.cpp:19:66: error: 'K' was not declared in this scope
   19 |     if (it != S[n].end() && it->first + i.first - 2 * dist[n] == K) ans = min(ans, it->second + i.second - 2 * dep[n]);
      |                                                                  ^