Logo
(追記) (追記ここまで)

18580번 - Long Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB70282842.424%

문제

Alice and Bob play a long game with a permutation p = (p1, p2, . . . , pn) of n integers from 1 to n. The permutation is written on a single strip. Alice makes her turn first, then the players take alternating turns. The player who is unable to make a move loses.

In the i-th turn, the player chooses one of the i strips, denote its length by m ≥ 2. Then he or she chooses an integer k (1 ≤ k < m) and cuts the chosen strip into two new strips with their lengths k and m − k. Here k means the index of an element of the chosen strip which becomes the last element of the first cut part, so the (k + 1)-th element goes to the beginning of the second part. But the following condition must hold after the cut: there should be at least one strip among all remaining strips whose elements form at least one inversion (that is, a pair of indices i, j such that i < j and pi > pj). If this condition is not met, a move is considered illegal and cannot be made. Note that the order of elements on newly formed strips does not change, and the players are not allowed to reverse or swap elements of any strip.

Given a permutation p of n integers, determine who wins if both players play optimally.

입력

The first line contains a single integer n (2 ≤ n ≤ 105), the length of the permutation.

The second line contains n space-separated integers p1, p2, . . . , pn (1 ≤ pi ≤ n, all pi are distinct): the permutation itself.

출력

Print a single word “Alice” if the first player wins, or “Bob” otherwise.

제한

예제 입력 1

5
3 4 1 2 5

예제 출력 1

Alice

예제 입력 2

7
1 2 3 4 5 6 7

예제 출력 2

Bob

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2019 > Day 6: Belarusian SU Contest L번

Contest > Open Cup > 2018/2019 Season > Stage 12: Grand Prix of Belarus L번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /