#P8369. [POI 2000 R1] 条纹
[POI 2000 R1] 条纹
Problem Description
The Stripes game is a two-player game. The required items are a board and rectangular stripes in three colors: red, green, and blue. All red stripes have size , all green stripes have size , and all blue stripes have size , where are positive integers. Each player has an unlimited number of stripes of each color.
A board is a rectangle of size , consisting of cells of size .
Players move alternately. In each move, a player chooses one rectangular stripe and places it on the board, following these rules:
- The stripe must not extend outside the board.
- It must not overlap any already placed stripe (not even partially).
- The edges of the stripe must coincide with the edges of the board cells.
Whoever cannot make a move loses.
The first player is the one who moves first in the game. Determine whether the first player has a winning strategy no matter how the second player plays.
Write a program that:
- Reads the stripe sizes and the sizes of at least one board.
- For each given board, determines whether the first player has a winning strategy.
- Outputs the results.
Input Format
The first line contains three integers , representing the lengths of the three stripes, in order: red, green, and blue. The numbers are separated by spaces.
The second line contains an integer , the number of different boards to consider. The following lines to each contain one integer . Line gives the length of the -th board.
Output Format
Output lines. Exactly one number should be written on the -th line:
If the first player has a winning strategy for the -th board, output ; otherwise output .
1 5 1
3
1
5
6
1
1
2
Hint
For of the data: .
Translated by ChatGPT 5