#P4096. [HEOI2013] Eden 的博弈树

[HEOI2013] Eden 的博弈树

Output Format

Print three space-separated positive integers on a single line: the index of the critical leaf node with the smallest index, the number of critical leaf nodes, and the bitwise XOR of the indices of all critical leaf nodes.

7 
1 
1 
2 
2 
3 
3
4 4 0 

Hint

[Sample explanation]

As shown, black nodes indicate Black-to-move nodes, and white nodes indicate White-to-move nodes.

All minimal Black-winning sets are {4,5}\{4, 5\} and {6,7}\{6, 7\}.

All minimal White-winning sets are {4,6}\{4, 6\}, {4,7}\{4, 7\}, {5,6}\{5, 6\}, and {5,7}\{5, 7\}.

Therefore, the set of critical leaf nodes is {4,5,6,7}\{4, 5, 6, 7\}.

  • For 30%30\% of the testdata, n100n \le 100.
  • For 40%40\% of the testdata, n1000n \le 1000.
  • For 50%50\% of the testdata, n104n \le 10 ^ 4, and the tree is randomly generated.
  • For 100%100\% of the testdata, 1n2×1051 \le n \le 2\times 10 ^ 5, and for node ii (i1i \ne 1), the index of its parent is less than ii.

Translated by ChatGPT 5