recently when i'am practicing i encounter two problems that have something common in them i could not understand editorial and others solutions too can someone help to find a approach for this kind of problems below are the links to two problems.
1237B - Сбалансированный тоннель ** the editorial to this problem written by tourist**
Spoiler