#C11716. Even-Odd Sum Game
Even-Odd Sum Game
Even-Odd Sum Game
You are given T test cases. In each test case, you are given a sequence of N integers. Alice and Bob play a game where they sum numbers from the sequence based on their indices. Alice takes the numbers at even indices (0-based indexing) and Bob takes the numbers at odd indices. Your task is to determine the winner for each test case by comparing the sum of numbers each player gets. If Alice's sum is larger than Bob's, the output is Alice
. If Bob's sum is higher, the output is Bob
. If both sums are equal, the output is Draw
.
Formally, given a sequence \(a_0, a_1, \dots, a_{N-1}\), let \[ S_A = \sum_{i \text{ even}} a_i, \quad S_B = \sum_{i \text{ odd}} a_i. \] Then, the result is: \[ \text{result} = \begin{cases} \text{Alice} & \text{if } S_A > S_B, \\ \text{Bob} & \text{if } S_B > S_A, \\ \text{Draw} & \text{if } S_A = S_B. \end{cases} \]
inputFormat
The first line contains an integer T, the number of test cases. Each test case consists of two lines: the first line contains an integer N representing the number of elements in the sequence, and the second line contains N space-separated integers.
outputFormat
For each test case, output a single line with one of the following strings: Alice
if the sum of even-indexed elements is greater than the sum of odd-indexed ones, Bob
if the sum of odd-indexed elements is greater, or Draw
if both sums are equal.
2
5
100 200 300 400 500
4
10 20 30 40
Alice
Bob
</p>