308932: CF1600E. Array Game

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Array Game

题意翻译

Alice 和 Bob 正在玩一个游戏。他们得到了一个长度为 $N$ 由整数组成的数组 $A$。 他们正在一起建立一个序列。在开始的时候,这个序列是空的。 在一个回合中,玩家可以从数组的左边或右边移出一个数字,并将其添加到序列的右侧。 规则是:他们所建立的序列必须是单调递增的。赢家就是是做出最后一步的玩家。 Alice 是第一个玩的。假设他们都以最佳方式进行游戏的情况下,谁能赢得游戏? **输入格式** 第一行包含一个整数 $N ( 1≤N≤2∗10^5)$。 第二行包含 $N$ 整数 $A_1$, $A_2$, ...,$A_N ( 0≤Ai≤10^9 )$ **输出格式** 第一行也是唯一一行输出包括一个字符串,即获胜者的名字。 如果 Alice 赢了,就输出 "Alice",否则就输出 "Bob"。 Translated from [Alan_CRL](https://www.luogu.com.cn/user/349225)

题目描述

Alice and Bob are playing a game. They are given an array $ A $ of length $ N $ . The array consists of integers. They are building a sequence together. In the beginning, the sequence is empty. In one turn a player can remove a number from the left or right side of the array and append it to the sequence. The rule is that the sequence they are building must be strictly increasing. The winner is the player that makes the last move. Alice is playing first. Given the starting array, under the assumption that they both play optimally, who wins the game?

输入输出格式

输入格式


The first line contains one integer $ N $ ( $ 1 \leq N \leq 2*10^5 $ ) - the length of the array $ A $ . The second line contains $ N $ integers $ A_1 $ , $ A_2 $ ,..., $ A_N $ ( $ 0 \leq A_i \leq 10^9 $ )

输出格式


The first and only line of output consists of one string, the name of the winner. If Alice won, print "Alice", otherwise, print "Bob".

输入输出样例

输入样例 #1

1
5

输出样例 #1

Alice

输入样例 #2

3
5 4 5

输出样例 #2

Alice

输入样例 #3

6
5 8 2 1 10 9

输出样例 #3

Bob

Input

题意翻译

Alice 和 Bob 正在玩一个游戏。他们得到了一个长度为 $N$ 由整数组成的数组 $A$。 他们正在一起建立一个序列。在开始的时候,这个序列是空的。 在一个回合中,玩家可以从数组的左边或右边移出一个数字,并将其添加到序列的右侧。 规则是:他们所建立的序列必须是单调递增的。赢家就是是做出最后一步的玩家。 Alice 是第一个玩的。假设他们都以最佳方式进行游戏的情况下,谁能赢得游戏? **输入格式** 第一行包含一个整数 $N ( 1≤N≤2∗10^5)$。 第二行包含 $N$ 整数 $A_1$, $A_2$, ...,$A_N ( 0≤Ai≤10^9 )$ **输出格式** 第一行也是唯一一行输出包括一个字符串,即获胜者的名字。 如果 Alice 赢了,就输出 "Alice",否则就输出 "Bob"。 Translated from [Alan_CRL](https://www.luogu.com.cn/user/349225)

加入题单

算法标签: