Birjik and Nicole's Tree Game

  • + 0 comments

    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.