Painting Squares
Time limit4sMemory limit1024 MB
Paint squares black or white and choose the smallest k so that the color pattern in any window of length k, together with whether it runs off the row, always identifies the window's start.
- Level
Hard8 of 10
- Topics
- String, Combinatorics, Greedy, Implementation
- Solved
- No attempts yet
Problem
Mike is playing a game with Peter. There are squares drawn on the ground in a single row, numbered to 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 ().
This game lasts a total of rounds. In each round, Mike will randomly pick a square (), and tell Peter the colours of the squares from positions to inclusive. If any of these positions are out of range, Mike will inform Peter accordingly as well. Peter will then need to correctly deduce based purely on this information alone.
Peter wishes to impress Mike, and thus wants to pick a value of that is as low as possible. Help Peter devise a strategy to win this game with the minimum possible value of .
Constraints
- ()