Hi,
I am trying to solve to solve this question.
I have also read the editorial 2-3 times but i am not getting the basic concept on how to solve this question.
Please help.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hi,
I am trying to solve to solve this question.
I have also read the editorial 2-3 times but i am not getting the basic concept on how to solve this question.
Please help.
Name |
---|
Which part? Trie stuff or game theory? Game theory in this problem is simply calculating the winner for each state of the game. If you can move the other player into a losing state from somewhere it is a winning state else it is a losing state. And if the state is a leaf of trie it is a losing state.
EDIT 1: And for this problem you need to calculate "can you lose if you want to" too in a similar way.
Game theory part.Am not clear what the states actually represent and how transition is done among states.Trie part is clear
As i said you need to calculate can you lose if you want to in a different array. But think for the normal problem first.Here is my submission 7403866 (yeah debugs everywhere). Each node of trie represents the string made by chars you have to pass through starting from the root. And you can calculate is a string is a wining or losing state for the Player Making Move On It(PMMOI) by checking each valid string you can make your move. If any of them are losing states for the PMMOI your string is a winning state because if you make that move other player will lose. But if there is no such move you will lose. You can fill the array win[] which holds is that stae is winning or not by iterating all trie array backwards because all childs of a node have a bigger id than that node. I fill the array lose at the same which holds can you lose if you want to for that string same way. After you have this information you can know which player can win or lose a one game you can find out who will win the Kth game.