QOJ.ac

QOJ

حد الوقت: 2.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100

#10872. 儿童游戏

الإحصائيات

Aubergine 和 Scallion 正在一个 $r \times c$ 的网格棋盘上玩游戏。棋盘上的每个格子都包含字符 'G'、'Z'、'D'、'P' 或 'X' 中的一个。

在这个游戏中,Scallion 和 Aubergine 轮流进行操作,Scallion 先手。 在 Scallion 的回合中,他可以选择两个水平相邻的格子,其中左侧格子为 'G',右侧格子为 'Z',并将这两个格子分别变为 'D' 和 'P'。在 Aubergine 的回合中,她可以选择两个垂直相邻的格子,其中上方格子为 'D',下方格子为 'P',并将这两个格子分别变为 'G' 和 'Z'。

如果轮到某位玩家时,该玩家有可以进行的操作,则他/她必须进行操作。无法进行操作的玩家输掉游戏。如果游戏在 $10^{100}$ 回合后仍未结束,则判定为平局。

Aubergine 和 Scallion 将会尽其所能进行游戏。这意味着如果一名玩家有获胜策略,他/她会选择获胜;如果一名玩家没有获胜策略但可以强制平局,他/她会选择平局。

给定游戏棋盘,编写一个程序来确定游戏的胜者。

输入格式

第一行包含两个整数 $r$ 和 $c$:棋盘的高度和宽度 ($2 \le r, c \le 2500$)。 接下来的 $r$ 行,每行包含 $c$ 个字符,中间没有空格:表示棋盘的内容。每个字符均为 'G'、'Z'、'D'、'P' 或 'X'。

输出格式

如果双方均采取最优策略且 Aubergine 获胜,输出 “Aubergine”。如果 Scallion 获胜,输出 “Scallion”。如果游戏以平局结束,输出 “Draw”。

样例

输入 1

3 3
GZX
PXG
XGZ

输出 1

Scallion

输入 2

2 2
GZ
PD

输出 2

Aubergine

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.