How does dynamic programming helps to solve this problem. Tutorials say run dp on every node of trie and determine state for each node. My question is how to use that data to determine final solution. I understand, we can get who would win by looking at the state of each leaf of trie. But what i do for more than one leaf. Also what first refers to here, person who started first game or person who starts each game ?
Problem: https://mirror.codeforces.com/contest/456/problem/D Tutorial: https://mirror.codeforces.com/blog/entry/13336