#P9860. Alice and Bob
Alice and Bob
Alice and Bob
Problem Description
Given an sequence of elements , . Alice and Bob will play a game alternating turns with Alice going first. If the current sequence length is , select a position () to divide the sequence into two part. If the sum of all elements from the first position to the position is less than the sum of all elements from the position to the last position, then delete the first element to the element. Otherwise, delete the element to the element. When the sequence length after a person's operation is , that person wins. Alice and Bob both want to win. If they can, they hope the element in the final sequence bigger. Otherwise, they hope the element in the final sequence smaller. Find the answer if both Alice and Bob play optimally.
Input
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows. The first line contains one integer (). The second line contains integers ( ). It's guaranteed that
Output
For each test case, first print "Alice" or "Bob" means who will win, then print an integer means the final sequence.
Sample Input
3
3
1 2 3
4
1 2 3 4
5
1 2 3 4 5
Sample Output
Bob 2
Alice 3
Alice 4
Source
2023“钉耙编程”中国大学生算法设计超级联赛(6)