CF 106147C - Game on tree

I can write the editorial, but there is a mismatch in the problem reference. The title and ID you gave are “Codeforces 106147C - Game on tree”, while the statement structure in the prompt does not include the actual statement text.

CF 106147C - Game on tree

Rating: -
Tags: -
Solve time: 29s
Verified: no

Solution

I can write the editorial, but there is a mismatch in the problem reference.

The title and ID you gave are “Codeforces 106147C - Game on tree”, while the statement structure in the prompt does not include the actual statement text. The closest matching Codeforces problem I can identify from the described game is 1970C3 - Game on Tree (Hard), where the solution uses Sprague-Grundy values and rerooting DP.

Please confirm whether you want the editorial for:

  1. Codeforces 1970C3 - Game on Tree (Hard), with input:
n t
n-1 edges
t starting vertices

and outputting Ron or Hermione, or 2. The actual 106147C problem, in which case please provide the problem statement or a link.

Once confirmed, I will produce the complete editorial in the requested format, including the Python solution and tests.