Submission #1172594

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11725942025-03-24 01:28:33versesrevRace (IOI11_race)C++20
Compilation error
0 ms0 KiB
// 23:47
#include <vector>
#include <utility>
#include <functional>
int best_path(int N, int K, int H[][2], int L[]) {
if (N == 1) {
return -1;
}
std::vector<std::vector<std::pair<int, int>>> edges(N, std::vector<std::pair<int, int>>());
for (int i = 0; i < N - 1; ++i) {
edges[H[i][0]].emplace_back(H[i][1], L[i]);
edges[H[i][1]].emplace_back(H[i][0], L[i]);
}
int ans = N + 1;
std::vector<bool> exist(N, true);
std::vector<std::vector<int>> subtree_sizes;
std::vector<std::vector<int>> dists;
std::vector<std::vector<int>> depths;
std::function<void(int, int)> dc = [&](int dc_depth, int root) {
if (dc_depth >= subtree_sizes.size()) {
subtree_sizes.emplace_back(N, 0);
dists.emplace_back(N, 0);
depths.emplace_back(N, 0);
}
// find centroid
int g = std::invoke([&]{
// return root;
auto& subtree_size = subtree_sizes[dc_depth];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

race.cpp: In instantiation of 'best_path(int, int, int (*)[2], int*)::<lambda(int, int)>::<lambda()>::<lambda(auto:3, int, int)> [with auto:3 = best_path(int, int, int (*)[2], int*)::<lambda(int, int)>::<lambda()>::<lambda(auto:3, int, int)>]':
race.cpp:40:19:   required from here
race.cpp:36:34: error: use of 'best_path(int, int, int (*)[2], int*)::<lambda(int, int)>::<lambda()>::<lambda(auto:3, int, int)> [with auto:3 = best_path(int, int, int (*)[2], int*)::<lambda(int, int)>::<lambda()>::<lambda(auto:3, int, int)>]' before deduction of 'auto'
   36 |           subtree_size[v] += self(self, u, v);
      |                              ~~~~^~~~~~~~~~~~
race.cpp: In instantiation of 'best_path(int, int, int (*)[2], int*)::<lambda(int, int)>::<lambda()>::<lambda(auto:4, int, int)> [with auto:4 = best_path(int, int, int (*)[2], int*)::<lambda(int, int)>::<lambda()>::<lambda(auto:4, int, int)>]':
race.cpp:50:26:   required from here
race.cpp:46:60: error: use of 'best_path(int, int, int (*)[2], int*)::<lambda(int, int)>::<lambda()>::<lambda(auto:4, int, int)> [with auto:4 = best_path(int, int, int (*)[2], int*)::<lambda(int, int)>::<lambda()>::<lambda(auto:4, int, int)>]' before deduction of 'auto'
   46 |           if (subtree_size[u] > total_size / 2) return self(self, u, v);
      |                                                        ~~~~^~~~~~~~~~~~