Painting Tiles

Limits: 1s, 512 MB

Alice and Bob are two best friends. They have a board of N tiles, which they need to paint. Initially the tiles are all unpainted. They think that painting them in a normal way feels kind of boring. That’s why they came up with a game in order to paint the board. During the game, they will play in turns. In each turn, the current player may select any number of unpainted cells in the range 2-5 inclusive, and paint all of them. In other words they can select 2, 3, 4 or 5 unpainted cells, and paint them all. The person who can’t paint anymore cells, loses. Alice is so excited to play the game that she always makes the first move. She doesn’t want to lose, otherwise she’ll have to give Bob a whole bowl of boiled eggs (which is his favorite food! :P) Given the size of the board, your task is to find out whether Alice will win or lose, provided that they both play optimally.

This is a companion discussion topic for the original entry at