In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Stripes is a two player game. Necessary requisites are a board and rectangular stripes in three colours: red, green and blue. All the red stripes have dimensions , green - , and blue - , where , and are integers. Players have at their disposal an unlimited pool of stripes of each colour.
A game board is a rectangle of dimensions and consists of fields of size .
Players make their moves by turns. Move consists of laying a stripe of any colour on the board. There are the following rules in force:
The first player is this one, who makes the first move in the game. It is said, that the first player has a winning strategy, if independently of the moves of the second player he can always win.
Write a program which:
The first line of the standard input consists of three integers , and , , equal to the lengths of stripes, adequately: red, green and blue ones. Numbers in the line are separated by single spaces.
The second line of the standard input consists of one number , , which is equal to the number of different boards to consider. Lines from the 3-rd to the ()-th consists of one number , . Number in the ()-th line is the length of the -th board.
The standard output should contain lines. Only one number should be written in the -th line of the file:
For the input data:
1 5 1 3 1 5 6
the correct result is:
1 1 2
Task author: Adam Borowski.