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

35040번 - Battle of Arrays 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 2048 MB141414100.000%

문제

Alice and Bob play a turn-based game. Initially, Alice has an array $a$ of $n$ positive integers, and Bob has an array $b$ of $m$ positive integers. The players take turns, with Alice moving first.

On a player's turn, they must choose one element $x$ from their own array and the maximal element $y$ from their opponent's array. Then they perform the following operation:

  • If $y \leq x$: the element $y$ is destroyed (removed from the opponent's array).
  • If $y > x$: the element $y$ is decreased by $x$ (the value of $y$ becomes $y - x$).

A player wins if, after their move, the opponent's array becomes empty.

Assuming both players play optimally, determine the winner.

입력

Each input contains multiple test cases. The first line contains the number of test cases $t$ (1ドル \le t \le 10^5$).

The first line of each test case contains two integers $n$ and $m$ (1ドル \le n,m \le 10^5$) --- the sizes of Alice's and Bob's arrays respectively.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ (1ドル \le a_i \le 10^9$) --- Alice's array.

The third line contains $m$ integers $b_1, b_2, \ldots, b_m$ (1ドル \le b_i \le 10^9$) --- Bob's array.

It is guaranteed that the sum of $n$ over all test cases does not exceed 10ドル^5$ and the sum of $m$ over all test cases does not exceed 10ドル^5$.

출력

For each test case, print the name of the winner of the game if both players follow the optimal strategy: "Alice" or "Bob".

제한

예제 입력 1

2
1 1
70
90
2 3
30 30
20 20 40

예제 출력 1

Alice
Bob

노트

In the first test Alice moves and decreases Bob's element by 70ドル,ドル so it becomes 20ドル$. Then Bob moves and decreases Alice's element by 20ドル,ドル so it becomes 50ドル$. Finally, Alice moves, destroys Bob's element, and wins.

출처

ICPC > Regionals > Northern Eurasia > Northern Eurasia Finals > Northern Eurasia Finals 2025 B번

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

출처

대학교 대회

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

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