#P1328. [NOIP 2014 提高组] 生活大爆炸版石头剪刀布
[NOIP 2014 提高组] 生活大爆炸版石头剪刀布
Description
Rock-paper-scissors is a common hand game: rock beats scissors, scissors beat paper, and paper beats rock. If two players show the same gesture, it is a draw. In Season 2, Episode 8 of “The Big Bang Theory,” an upgraded version of the game appears.
On top of the traditional rock-paper-scissors game, the upgraded version adds two new gestures:
Spock: one of the main characters in Star Trek.
Lizard: a villain in Star Trek.
The win–loss relationships among the five gestures are shown in Table 1. The table lists the result of player A versus player B.

Now, Xiao A and Xiao B are trying this upgraded hand game. It is known that their moves follow periodic patterns, though their period lengths may differ. For example: if Xiao A plays with the period 石头-布-石头-剪刀-蜥蜴人-斯波克 of length , then his sequence of moves is 石头-布-石头-剪刀-蜥蜴人-斯波克-石头-布-石头-剪刀-蜥蜴人-斯波克-...; and if Xiao B plays with the period 剪刀-石头-布-斯波克-蜥蜴人 of length , then his sequence of moves is 剪刀-石头-布-斯波克-蜥蜴人-剪刀-石头-布-斯波克-蜥蜴人-....
They will play a total of rounds. In each round, the winner gets point, the loser gets points; in a draw, both get points. Please compute the scores of the two players after rounds.
Input Format
The first line contains three integers: , representing the total number of rounds, the period length of Xiao A’s moves, and the period length of Xiao B’s moves, respectively. The numbers are separated by a space.
The second line contains integers representing Xiao A’s pattern, and the third line contains integers representing Xiao B’s pattern. Here, denotes 剪刀, denotes 石头, denotes 布, denotes 蜥蜴人, and denotes 斯波克. The numbers are separated by a space.
Output Format
Output a single line containing two integers separated by a space, representing the scores of Xiao A and Xiao B, respectively.
10 5 6
0 1 2 3 4
0 3 4 2 1 0
6 2
9 5 5
0 1 2 3 4
1 0 3 2 4
4 4
Hint
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号