|
|
in tree sum of vertex <= n + n/2 + n/4 +... = n*(1 + 1) = 2n Take attention: No matter whose turn it is,if all the color is A,than Alise win,else Bob win. I have WA8. Who can help with test? 6 ABAAAA AAAAAA -- Alice wins Edited by author 02.08.2021 17:16 I solved this problem as follows: each player will try to choose the side that has less chance to win against the other. In my examples, everything works, but when I submit for verification, test 6 fails =(. Please explain how to solve it, I'm a beginner, and very interested in solving this problem. How do you calculate the chances of winning on the chosen side? You can build binary tree Left child corresponds to inward fold Right child corresponds to outward fold Root is unfolded strip Build tree from root to leaves and before going deeper check winning conditions Could anyone give me some sample input and output? Thanks a lot. 4 BBAA BABB = Bob Почему в исходном примере выигрывает Боб? Если при первом сгибе получаем полоску АА, значит должна выиграть Алиса... Почему нет? There is information:"Если после очередного сгиба полоска стала полностью одноцветной".It's mean, both of sides needs to have one color |
|
|