LCC '18 Contest 1 J4 - Betting

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type

MLE Who 1 and MLE Who 2 are playing a game.

In this game, there are N coins of equal value placed on a table. MLE Who 1 always goes first. She takes a coin, as well as the coins adjacent to it. Thus, if she takes a coin on the ends, she takes exactly 2 coins, and if she takes a coin not on the ends, she takes exactly 3 coins. Note that if there is only one coin left, she will only take that one coin. The coins that she takes are removed from the table altogether, and the other coins are placed adjacent to one another. After MLE Who 1 does this, it is MLE Who 2's turn. The two people will alternate turns, until there are no coins left on the table. The person who cannot take any coin loses.

MLE Who 1 and MLE Who 2 are each betting that they will win. You want to help MLE Who 1 to determine if she can win if both MLE Whos play optimally.

Input Specification

The first line will contain the integer N (1 \le N \le 10^5), the number of coins on the table.

Output Specification

If MLE Who 1 wins if they both play optimally, print You will win!. Otherwise, print You will lose!.


Subtask 1 [10%]

N \le 10

Subtask 2 [30%]

N \le 1 000

Subtask 3 [60%]

No further constraints.

Sample Input 1


Sample Output 1

You will win!

Sample Input 2


Sample Output 2

You will lose!


  • 5
    ryan_ug  commented on Oct. 26, 2021, 9:18 p.m.

    holy moly