#K80057. Resource Gathering Battle
Resource Gathering Battle
Resource Gathering Battle
Problem Statement:
You are given an ( n \times n ) grid where each cell contains a positive integer representing the value of a resource. Two factions, Alpha and Omega, are competing to gather these resources. The rules of the game are as follows:
1. First, all the resource values in the grid are collected and sorted in ( \text{non-increasing} ) order (i.e., from the largest to the smallest).
2. The factions take turns picking resources from this sorted list. Alpha picks first, then Omega, and so on.
3. After all resources have been selected, the faction with the greater total resource value wins. If both factions accumulate the same total, the result is a tie.
Formally, let the sorted resource values be ( a_1, a_2, \dots, a_{n^2} ) such that ( a_1 \geq a_2 \geq \dots \geq a_{n^2} ). Then Alpha's total is ( \displaystyle \sum_{i , \text{odd}} a_i ) and Omega's total is ( \displaystyle \sum_{i , \text{even}} a_i ). Your task is to determine the winning faction or declare a tie based on these totals.
inputFormat
Input is provided via standard input (stdin).
The first line contains an integer ( T ), representing the number of test cases.
For each test case:
- The first line contains an integer ( n ), which is the size of the grid.
- The next ( n ) lines each contain ( n ) space-separated integers representing the grid's resource values.
outputFormat
For each test case, output a single line on standard output (stdout) containing one of the following strings: "Alpha", "Omega", or "Tie", indicating the winner of the resource gathering battle.## sample
3
3
1 2 3
4 5 6
7 8 9
2
5 5
5 5
2
8 7
7 8
Alpha
Tie
Tie
</p>