P8658 [Lanqiao Cup 2017 National A] Fill Letters Game
Description
Xiaoming often plays the game LOL and is addicted to it. One time he wanted to challenge Master K, but Master K said:
“Let’s first play a game of filling letters into blanks. If you can’t beat me, then don’t play LOL anymore.”
Master K draws a row of $n$ cells on paper, and asks Xiaoming and him to take turns filling letters into them.
Rules:
1. When it is someone’s turn, they can only fill `L` or `O` into one empty cell.
2. Whoever first makes the letters form the string `LOL` wins.
3. If all cells are filled and `LOL` still cannot be formed, then it is a draw.
Xiaoming tried several times and lost every time. He feels ashamed and hopes you can help him solve this puzzle using a computer.
Input Format
The input format is:
The first line contains an integer $n$ ($n
Output Format
Output $n$ numbers. For each position, if Xiaoming plays first and Master K always uses the strongest moves, output Xiaoming’s best possible result.
`1` means Xiaoming can win.
`-1` means Xiaoming will definitely lose.
`0` means Xiaoming can force a draw.
Explanation/Hint
Time limit: 1 second, 256M. Lanqiao Cup, 2017, the 8th National Finals.
Translated by ChatGPT 5