Universal Cup Judging System

Universal Cup

حد الوقت: 1.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100
الإحصائيات

Menji 博士は AI の専門家です。現在、彼は AGI(Artificial Game Intelligence)である Bot を訓練しています。

Bot にゲームの遊び方を教えるため、彼は毎日 Bot と遊んでいます。今日、彼らは次のゲームをプレイしています:

ゲームは、$2n$ 個の非負整数からなる列 $a_1, a_2, \cdots, a_{2n}$ と、$1$ つの数 $S$ から始まります。初期状態では $S = 0$ です。

Menji と Bot は交互に手番を行い、Menji が先手です:

  • Menji の手番では、列から数 $x$ を $1$ つ選び、$S \leftarrow S \oplus x$ と更新し、列から $x$ を削除します。なお、$\oplus$ はビットごとの排他的論理和(XOR)関数です。
  • Bot の手番では、列から数 $x$ を $1$ つ選び、列から $x$ を削除します。

列に数が残っていなくなった時点でゲームは終了します。最終的に $S = 0$ である場合、かつその場合に限り Menji の勝利となり、そうでない場合は Bot の勝利となります。

Menji は、両方のプレイヤーが最適にプレイした場合、どちらがゲームの勝者になるかを知りたがっています。

入力

入力は複数のテストケースを含みます。$1$ 行目には、テストケースの個数を表す整数 $T$($1 \le T \le 10^5$)が含まれます。

各テストケースについて、$1$ 行目には問題文で説明された整数 $n$($1 \le n \le 10^5$)が含まれます。

$2$ 行目には、ゲーム内の整数を表す $2n$ 個の整数 $a_1, a_2, \cdots, a_{2n}$($0 \le a_i < 2^{30}$)が含まれます。

すべてのテストケースにおける $n$ の総和は $2 \times 10^5$ を超えないことが保証されています。

出力

各テストケースについて、Menji がゲームに勝てる場合は $1$ 行に Menji と出力し、そうでない場合は $1$ 行に Bot と出力してください。

入出力例

5
2
1 1 3 3
2
1 1 1 3
3
1 1 4 5 1 4
3
1 9 1 9 8 10
6
1 1 4 5 1 4 1 9 1 9 8 10
Bot
Menji
Menji
Menji
Bot

注記

$1$ つ目のテストケースでは、Menji がどの数を選んでも、Bot は常に同じ数を選ぶことができるため、Menji は常に $1$ と $3$ を $1$ つずつ選ぶことになり、$S = 1 \oplus 3 = 2 \neq 0$ となるので、Bot が常に勝つことができます。

$2$ つ目のテストケースでは、Menji は最初のターンに $1$ を選ぶことができます。Bot が何を選んでも、Menji はもう $1$ つの $1$ を選ぶことができるため、Menji は常に $2$ つの $1$ を受け取り、$S = 1 \oplus 1 = 0$ となるので、Menji が常に勝つことができます。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.