QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#8722. 卡牌游戏

Statistics

Alice and Bob are playing a card game.

Each card is labeled with a number from 1 to N. Alice has Ai cards labeled with number i, and Bob has Bi cards labeled with number i.

The game consists of several rounds. In each round, the winner of the previous round starts (if it is the first round, Alice starts). Players take turns making the following decisions:

  • Play a Card: Choose a card that has the same number as the card played in the previous turn of the current round. If no card has been played yet in the current round, any card can be chosen.
  • Pass: Choose to pass, ending the current round. The opponent then wins the current round. Note that if no card has been played yet in the current round, you cannot choose to pass.

At any point, if a player has played all their cards, that player wins the entire game, and the game ends.

There are T independent queries. For each query, assuming both Alice and Bob know each other's cards and both play optimally, determine who will win the game.

Input

  • The first line contains an integer T (1 ≤ T ≤ 106), the number of queries.
  • Each query consists of the following:
    • The first line contains an integer N (1 ≤ N ≤ 106).
    • The second line contains N integers A1, A2, ..., AN (0 ≤ Ai ≤ 109, at least one Ai > 0).
    • The third line contains N integers B1, B2, ..., BN (0 ≤ Bi ≤ 109, at least one Bi > 0).

It is guaranteed that the total sum of N across all queries does not exceed 106.

Output

For each query, output a single line containing either "Alice" if Alice wins the game or "Bob" if Bob wins the game.

Example

Input:

5
1
100
100
2
1 1
1 1
2
1 1
0 1
3
1 1 4
5 1 4
10
116 104 101 114 101 32 97 114 101 32
102 105 118 101 32 99 97 115 101 115

Output:

Alice
Bob
Alice
Alice
Alice

Explanation

  • First Query: One possible game sequence is as follows: Alice and Bob alternately play cards labeled 1. Alice plays the last card when Bob still has one card remaining, thus Alice wins the game.

  • Second Query: One possible game sequence is as follows: Alice plays a card labeled 1, Bob plays a card labeled 1, Alice passes, and Bob wins the first round. Then, Bob plays the last card labeled 2, winning the game.

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.