помоги решить задачу на с++ с Atcoder Problem Statement Takahashi and Aoki will play a…
- User
помоги решить задачу на с++ с Atcoder Problem Statement Takahashi and Aoki will play a game using cards with numbers written on them.
Initially, Takahashi has N cards with numbers A 1 ,…,A N in his hand, Aoki has M cards with numbers B 1 ,…,B M in his hand, and there are L cards with numbers C 1 ,…,C L on the table. Throughout the game, both Takahashi and Aoki know all the numbers on all the cards, including the opponent's hand.
Starting with Takahashi, they take turns performing the following action:
Choose one card from his hand and put it on the table. Then, if there is a card on the table with a number less than the number on the card he just played, he may take one such card from the table into his hand. The player who cannot make a move first loses, and the other player wins. Determine who wins if both players play optimally.
It can be proved that the game always ends in a finite number of moves.
Constraints 1≤N,M,L N+M+L≤12 1≤A i ,B i ,C i ≤10 9
All input values are integers. Input The input is given from Standard Input in the following format:
N M L A 1
… A N
B 1
… B M
C 1
… C L
Output Print Takahashi if Takahashi wins, and Aoki if Aoki wins. вот пример входных данных ввод 1 1 2 2 4 1 3 вывод Aoki разбор примера The game may proceed as follows (not necessarily optimal moves):
Takahashi plays 2 from his hand to the table, and takes 1 from the table into his hand. Now, Takahashi's hand is (1), Aoki's hand is (4), and the table cards are (2,3). Aoki plays 4 from his hand to the table, and takes 2 into his hand. Now, Takahashi's hand is (1), Aoki's hand is (2), and the table cards are (3,4). Takahashi plays 1 from his hand to the table. Now, Takahashi's hand is (), Aoki's hand is (2), and the table cards are (1,3,4). Aoki plays 2 from his hand to the table. Now, Takahashi's hand is (), Aoki's hand is (), and the table cards are (1,2,3,4). Takahashi cannot make a move and loses; Aoki wins.
ответ пиши на русском пожалйуста
- Assistant