QOJ.ac

QOJ

时间限制: 4 s 内存限制: 1024 MB 总分: 100 交互

#12141. 奇偶博弈

统计

每个星期六,Eve 都会去当地的游戏俱乐部。今天,Bob 带来了一个他自己设计的游戏。经过仔细研究,你声称该游戏存在必胜策略,即其中一名玩家总是可以获胜。Bob 不愿承认他的游戏玩起来很无聊,于是他向你发起挑战,要和你玩一局!既然你声称存在必胜策略,你可以决定谁先手。

图 E.1:两个交互样例中的卡牌。

游戏规则如下:桌上有 $n$ 张卡牌,每张卡牌包含一个数学运算($+$ 或 $*$)和一个整数,如图 E.1 所示。Eve 和 Bob 交替抽取卡牌,利用其中一张卡牌对一个公共数值进行操作。例如,如果当前数值为 $5$,而卡牌显示为 $+3$,则数值更新为 $8$。每张卡牌只能使用一次,当所有卡牌都被使用后游戏结束。如果最终数值为奇数,则先手玩家获胜;如果最终数值为偶数,则另一名玩家获胜。给定卡牌列表和初始数值,请帮助 Eve 赢得游戏。

交互

交互器首先输出游戏的初始状态,格式如下: 一行包含一个整数 $n$ ($1 \le n \le 300$),表示卡牌数量。 $n$ 行,每行包含一个字符 $o$ 和一个整数 $x$ ($o \in \{‘+’,‘*’\}, 1 \le x \le 10^6$),表示其中一张卡牌。 * 一行包含一个整数 $x$ ($1 \le x \le 10^6$),表示初始数值。

保证输入中的 $n$ 张卡牌各不相同。

然后,你的程序必须输出 “me” 或 “you”,取决于你想要先手还是让交互器先手。

接着,你的程序与交互器交替输出卡牌,格式与上述相同。每张卡牌不能被使用超过一次。无论最后一步由哪位玩家完成,你的程序都必须在所有卡牌使用完毕后退出。

如果你的程序遵循上述所有规则,且最终数值的奇偶性与你输出的第一行所暗示的获胜条件一致,则你的提交将被接受。

确保在每次写入后刷新缓冲区。

提供了一个测试工具来帮助你开发解决方案。

样例

样例 1

3
+ 7
* 4
+ 2
1
me
+ 2
* 4
+ 7

样例 2

2
+ 8
* 5
10
you
+ 8
* 5

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.