Here is my code for ARRGAME , passing all the test cases , but still giving WA .
It would be of great help, if someone helps me by giving a suitable testcase which contradicts mine code . Problem Link : ARRGAME Problem - CodeChef My Code : CodeChef: Practical coding for everyone
Output for 1st test case is giving “No” in mine code and second test case is not valid (I think so) as it is given in constraints that : A1 = An = 1 , so , there should be 1 at both starting and ending position .
Thank you for mentioning that. I did not notice that.
If you notice closely then there is always one strategy for the first player.
-> choose maximum segment of zeros and sit in the middle If n is odd.
-> If n is even, then he can sit on either position of that segment. (n/2), (n/2)-1
n = size of the maximum segment of zeros
But second player can play with two strategies.
-> either sit besides the first player so as to block all possible choices of one side
-> Or sit in completely different segment.
I can see both the strategies are independent of 1’s at both the ends.
Yeah, may be bcoz of this its giving WA , but it is strange that it is giving correct outputs on codechef compiler regarding this case on running manually.