We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Nice problem. The editorial C++ solution has one small bug. When using dfs to do the tree traversal, we should consider the max depth of the tree. The max depth could be n=300000 and it will cause the segmentation fault due to the maximum stack level limit. Luckily, no such cases in test data. I suggest everyone to use array or other algorithms to solve the tree traversal to avoid the segmentation fault.
Nice problem. The editorial C++ solution has one small bug. When using dfs to do the tree traversal, we should consider the max depth of the tree. The max depth could be n=300000 and it will cause the segmentation fault due to the maximum stack level limit. Luckily, no such cases in test data. I suggest everyone to use array or other algorithms to solve the tree traversal to avoid the segmentation fault.
Do you want to unlock and read the editorial? If you do, your score will not be counted toward your progress.
Does this mean ratings would not be counted ? Can I open the editorial now as the contest has ended ?