TABGAME - Editorial

I read this editorial twice but still can’t get the intuition behind making two separate cases for filling row1,col1 and row2…n,col2…n. Can someone make me understand this part ?

If(A0,j==W) then Aij=W//I can win by moving to cell (0,i)

Not able to understand this line.

Thanks in advance :slight_smile:

Which line made you think that you HAVE to fill ONLY that way? I might help there! You can fill anyway if I recall correctly- there are multiple valid ways out of which any can be chosen.

actually, I am not able to understand this part.
Could please provide comments over filling of the table for row 1.

Row 1-

Else if (A1,j−1==L) then Aij=W//I can force my opponent to lose by moving to cell (1,j−1)
Else A1j=L```

Here, if A[0][j]=='W' then why A[i][j]='W'??

Assume 1 based indexing, where A[0][j] represents the j’th character in string (just like shown in pciture, string character above column). If ending up on that cell is W, then I will just move my cell to that and win. Dont assume Row 1 corresponds to 0’th index in array. 0’th index is for string.

1 Like

@vijju123 could you provide your solution for this problem as above links are not working.

I have to ask @admin to fix link to setter’s codee :confused: . There was no code of setter at testing page else Iwould have pasted it. It was with @admin .

There wasnt any editorialist solution, idk which solution he linked lol. You can refer to @um_nik 's code for now - its based on editorial except that it calculates for first 10 rows. I will try to upload my solution by evening.

Can I somehow get test data for past problems, that my solution failed? It is often very helpful for debugging. For any problem, not for this one.

My solution
I had created two functions for alice and bob. Then I subtracted min(x,y) - 2 from both x and y. Then called alice(x,y ).
Was getting NZEC ( probably Stack Overflow. )
So, for both alice and bob, tried decreasing which is lower between x and y first, then the higher.
Got AC. :slight_smile: