#P9586. 「MXOI Round 2」游戏
「MXOI Round 2」游戏
Problem Description
Xiao C and Xiao D are playing a fast-growing game.
This game has a total of types of hand cards: Kill, Dodge, Slash. Their uses are as follows:
- Kill: use it on the opponent; the opponent must use a Dodge, otherwise the opponent loses the game; or respond to the opponent’s Slash.
- Dodge: respond to the opponent’s Kill.
- Slash: use it on the opponent; the opponent must use a Kill, otherwise the opponent loses the game.
After a player uses a card, they must discard the card they used.
Starting from Xiao C, each turn belongs to Xiao C and Xiao D alternately. During a player’s turn, that player may play any number of Kill and Slash, and the opponent must make the corresponding responses. Of course, the player may also choose not to play any card and directly enter the opponent’s turn.
Now, Xiao C has Kill cards, Dodge cards, and Slash cards; Xiao D has Kill cards, Dodge cards, and Slash cards. Both sides know each other’s hands. You need to determine what the result of the game will be when both sides use optimal strategies.
Input Format
This problem contains multiple test cases.
The first line contains an integer , representing the number of test cases.
Then for each test case, one line contains six integers .
Output Format
For each test case, output one line:
- If, under optimal play from both sides, Xiao C can win, output
C. - If, under optimal play from both sides, Xiao D can win, output
D. - If, under optimal play from both sides, the game ends in a draw, meaning neither side can win, output
E.
3
3 1 4 1 5 9
1 1 4 5 1 4
5 2 1 2 6 3
C
D
E
Hint
Sample Explanation #1
For the first set of data, Xiao C can play a Slash first, and after Xiao D responds with a Kill, play another Slash. At this time, Xiao D has used up all Kill cards and cannot respond, so Xiao D loses the game.
Sample #2
See game/game2.in and game/game2.ans in the additional files.
Constraints
For of the testdata, , .
| Test Point ID | Special Property |
|---|---|
| Guarantee . | |
| Guarantee and . | |
| None. |
Translated by ChatGPT 5