#C8384. Score Game Winner Determination

    ID: 52360 Type: Default 1000ms 256MiB

Score Game Winner Determination

Score Game Winner Determination

In this problem, Alice and Bob are playing a game where each has a list of N integers. The score for each player is calculated using a weighted sum after sorting their numbers in non-increasing order. Specifically, if the sorted list is \( a_1, a_2, \ldots, a_N \) (with \( a_1 \) being the largest), then the score is computed as:

$$score = \sum_{i=1}^{N} i \times a_i$$

The winner is determined by comparing the scores:

  • If Alice's score is greater than Bob's, output "Alice".
  • If Bob's score is greater than Alice's, output "Bob".
  • If the scores are equal, output "Tie".

You are given multiple test cases. For each test case, compute the winner accordingly.

inputFormat

The input is read from standard input (stdin) and consists of multiple test cases. The first line contains a single integer \(T\), the number of test cases. Then for each test case:

  • A line containing an integer \(N\) representing the number of elements in each list.
  • A line containing \(N\) space-separated integers for Alice's list.
  • A line containing \(N\) space-separated integers for Bob's list.

outputFormat

For each test case, output one line from standard output (stdout) containing the result: "Alice", "Bob", or "Tie".

## sample
2
3
2 3 5
1 -3 7
4
1 2 3 4
1 2 3 4
Alice

Tie

</p>