#P1968D. Permutation Game
Permutation Game
No submission language available for this problem.
Description
Bodya and Sasha found a permutation and an array . They decided to play a well-known "Permutation game".
A permutation of length is an array consisting of distinct integers from to in arbitrary order. For example, is a permutation, but is not a permutation ( appears twice in the array), and is also not a permutation ( but there is in the array).
Both of them chose a starting position in the permutation.
The game lasts turns. The players make moves simultaneously. On each turn, two things happen to each player:
- If the current position of the player is , his score increases by .
- Then the player either stays at his current position or moves from to .
Knowing Bodya's starting position and Sasha's starting position , determine who wins the game if both players are trying to win.
The first line contains a single integer () — the number of testcases.
The first line of each testcase contains integers , , , (, ) — length of the permutation, duration of the game, starting positions respectively.
The next line contains integers () — elements of the permutation .
The next line contains integers () — elements of array .
It is guaranteed that the sum of values of over all test cases does not exceed .
For each testcase output:
- "Bodya" if Bodya wins the game.
- "Sasha" if Sasha wins the game.
- "Draw" if the players have the same score.
Input
The first line contains a single integer () — the number of testcases.
The first line of each testcase contains integers , , , (, ) — length of the permutation, duration of the game, starting positions respectively.
The next line contains integers () — elements of the permutation .
The next line contains integers () — elements of array .
It is guaranteed that the sum of values of over all test cases does not exceed .
Output
For each testcase output:
- "Bodya" if Bodya wins the game.
- "Sasha" if Sasha wins the game.
- "Draw" if the players have the same score.
Note
Below you can find the explanation for the first testcase, where the game consists of turns.
Turn | Bodya's position | Bodya's score | Bodya's move | Sasha's position | Sasha's score | Sasha's move |
first | stays on the same position | moves to | ||||
second | stays on the same position | stays on the same position | ||||
final results |
As we may see, Bodya's score is greater, so he wins the game. It can be shown that Bodya always can win this game.