electicode
HomeCoursesResourcesProblemsNational OlympiadContestsLeaderboard
...

Arithmetic Game

Time Limit: 1000msMemory Limit: 256MB
View EditorialView Submissions

Problem Description

Alice and Bob are very bored, so they decided to play a short game on a piece of paper. First, they write down nnn (n≥3)(n \ge 3)(n≥3) numbers a1,a2,...,ana_1, a_2, ..., a_na1​,a2​,...,an​. Then they calculate the score, which is the arithmetic mean of the list and write it at the edge of the paper so they don't forget.

Alice and Bob each have exactly one turn; Alice goes first. On each turn, a player chooses any element and removes it from the list. Once both players have finished their turns, the score is calculated again with the new list. If the final score is less than the initial score, Alice wins; if it remains the same, the game ends in a Tie; otherwise, Bob wins.

If Alice and Bob play optimally, output the result of the game.

  • Arithmetic mean of a list aaa of size nnn is calculated as: ⌊a1+a2+⋯+ann⌋ \lfloor \frac{a_1 + a_2 + \dots + a_n}{n} \rfloor⌊na1​+a

Input format

The first line contains nnn (3≤n≤106)(3 \le n \le 10^6)(3≤n≤106) --- the number of elements in aaa.

The next line contains nnn numbers a1,a2,...,ana_1, a_2, ..., a_na1​,a2​,...,an​ --- the initial list before any changes.

Output format

For each test, output on a separate line:

  • Alice, if the final score is less than the initial score.
  • Tie, if the final score will be the same as the initial score.
  • Bob, if the final score is greater than the initial score.

Scoring system

GroupAdditional constraintsPointsRequired subtasks
0Tests from examples0—
1n=3n = 3n=320—
2All aia_ia are the same

Examples

Example 1
Input
4
1 2 3 4
Output
Tie
Example 2
Input
3
76 99 72
Output
Alice

© 2026 Electicode. All rights reserved.

2
​
+
⋯
+
an​
​
⌋
(1≤ai≤109)(1 \le a_i \le 10^9)
(1≤ai​≤109)
i
​
15
—
3n≤103n \le 10^3n≤103250, 1
4No restrictions400–3