Problem 3800 --GCD Game

3800: GCD Game

"
Time Limit $1$ 秒/Second(s) Memory Limit $128$ 兆字节/Megabyte(s)
提交总数 $7$ 正确数量 $3$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 博弈
Alice and Bob are playing a game. 

They take turns to operate. There are n numbers, a1 , a2 , ... , an. Every time, the player plays in 3 steps.
1.Arbitrarily chooses one number ai
2.Arbitrarily chooses another number x(1≤x<ai).
3. Replace the number ai with gcd(ai,x). Here, gcd(u,v) refers to the Greatest Common Divisor of u and v

When a player can not make a single move he/she loses the game. Alice moves the first and she asks you to tell her who will win the game if both player play optimally.
The first line contains a number T(1≤T≤100), the number of testcases.

For each testcase, there are two lines.
The first line contains one number n(1≤n≤106).
The second line contains n numbers a1 , a2 , ... , an(1≤ai≤107).

It is guaranteed that for all testcases, ∑n≤106.
For each testcase, output the answer in one line. If Alice will win the game, print "Alice", otherwise print "Bob".
2
1
1
1
2
Bob
Alice

推荐代码 查看3800 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$632 $ms] 月落星辰挽 843781 2022-04-17 20:20:46
内存最少[$118304 $KB] 月落星辰挽 843781 2022-04-17 20:20:46
第一AC 月落星辰挽 843754 2022-04-17 20:11:39
第一挑战 月落星辰挽 843743 2022-04-17 20:10:20

赛题来源/所属竞赛 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛