Painting Squares

아직 제출이 없습니다시간 제한4초메모리 제한1024 MB

문제

Mike is playing a game with Peter. There are nn squares drawn on the ground in a single row, numbered 00 to n1n-1 from left to right. At the start of the game, Peter is allowed to paint each of these squares either black or white. He will then give Mike a single positive integer kk (1kn1 \leq k \leq n).

This game lasts a total of qq rounds. In each round, Mike will randomly pick a square xx (0x<n0 \leq x \lt n), and tell Peter the colours of the squares from positions xx to x+k1x+k-1 inclusive. If any of these positions are out of range, Mike will inform Peter accordingly as well. Peter will then need to correctly deduce xx based purely on this information alone.

Peter wishes to impress Mike, and thus wants to pick a value of kk that is as low as possible. Help Peter devise a strategy to win this game with the minimum possible value of kk.

제한

  • 1r101 \leq r \leq 10
  • 2n,q10002 \leq n, q \leq 1000
  • 1c\[i]1-1 \leq c\[i] \leq 1 (0i<k0 \leq i \lt k)