Editorial

Editorial for Chef and Tic-Tac-Toe

The problem is very simple for K=1.


For K=1 :

      Simply check if there exists any cell on the board which has a '.' and if it exists then the answer is **YES** else **NO**.

For K>1 :

      If we encounter a '.' then we need to check 4 things.
  1. Check number of consecutive ‘X’ in the corresponding row(r).
  2. Check number of consecutive ‘X’ in the corresponding column(c).
  3. Check number of consecutive ‘X’ in the corresponding left diagnol(ld).
  4. Check number of consecutive ‘X’ in the corresponding right diagnol(rd).

If at any step the count of (r>=K) or (c>=K) or (ld>=K) or (rd>=K) then break and the answer is YES.
ELSE if after all steps none of the counts>=K then the answer is NO.


Here is the code for the same.

link text

False. This is not an editorial for Chef and Tic-Tac-Toe.

I have posted it as an answer.