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

19300번 - Game of Sorting 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB40131241.379%

문제

Alice and Bob have invented a new game to play. First, they get a sequence. And then they take turns to make the following moves. During each move, the play will choose either the first element of the sequence or the last element, and remove the chosen element. The player who makes the sequence nondecreasing or nonincreasing wins. If the initial sequence is a nondecreasing or nonincreasing sequence, Bob wins the game.

The winter vacation is boring, so the kids want to play this game many times. Initially, they have a sequence of length $n$: $a_1, a_2, \ldots, a_n$. Alice realized that if they start the game after removing some of the first elements of the sequence and some of its last elements, you can get completely different results.

Alice and Bob played the game $Q$ times in total. The question is who will finally win each game if both players play optimally. Remember that Alice always moves first.

입력

The first line contains an integer $n,ドル the length of the initial sequence (3ドル \le n \le 10^6$).

The second line contains $n$ space-separated integers $a_1, a_2, \ldots, a_n$: the sequence itself (1ドル \le a_i \le 10^9$).

The third line contains an integer $Q$ (1ドル \le Q \le 10^6$).

The $i$-th of the following $Q$ lines contains integers $L_i$ and $R_i$ (1ドル \le L_{i} \le R_{i} \le n$). It means that the initial sequence of $i$-th game is $a_{L_i}, a_{L_i + 1}, \ldots, a_{R_i}$.

출력

Print $Q$ lines with the winner's name, one for each query.

제한

예제 입력 1

4
1 5 3 4
3
1 2
1 3
1 4

예제 출력 1

Bob
Alice
Bob

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 5: Grand Prix of Korea J번

Contest > Open Cup > 2017/2018 Season > Stage 10: Grand Prix of Korea J번

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

출처

대학교 대회

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

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