#C8922. Taco Game Winner Determination
Taco Game Winner Determination
Taco Game Winner Determination
In this problem, two players, Alice and Bob, play a game with an array of integers. The game is played as follows:
- The input consists of an integer n representing the number of elements, followed by n integers.
- Sort the array in non-increasing order.
- Alice picks the first element, Bob picks the second, then Alice picks the third, and so on.
The final score for each is the sum of the numbers they picked. Formally, if the sorted array is \(a_0, a_1, \ldots, a_{n-1}\), then:
[ \text{Alice's score} = \sum_{i=0}^{\lfloor (n-1)/2 \rfloor} a_{2i}, \quad \text{Bob's score} = \sum_{i=0}^{\lfloor (n-2)/2 \rfloor} a_{2i+1} ]
Based on the scores, output "Alice" if Alice wins, "Bob" if Bob wins, or "Tie" if the scores are equal.
inputFormat
The input is given via standard input (stdin) in the following format:
- The first line contains an integer n (\(1 \le n \le 10^5\)), the number of elements in the array.
- The second line contains n space-separated integers representing the elements of the array.
outputFormat
Output a single line to standard output (stdout) containing one of the following: "Alice", "Bob", or "Tie", depending on who wins the game.
## sample5
1 2 3 4 5
Alice