QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 262144 MB Points totaux : 100 Interactif

#13121. 芝华士

Statistiques

这是一个交互式问题。

你需要打开一把密码锁。这把密码锁的密码是一个长度为 $n$($n$ 为奇数)的字符串,由小写或/和大写拉丁字母组成。

你可以执行以下三种操作:

  • 判定无法可靠地确定密码。
  • 尝试猜测密码。你不能做出错误的猜测。
  • 检查某个包含 $n$ 个拉丁字母的字符串。你将得到如下所述的响应。你最多可以进行 1000 次此类查询。

设 $s$ 为正确的密码,$t$ 为你给出的待检查字符串。设 $a$ 为满足 $t_i < s_i$ 的下标 $i$ 的个数,$b$ 为满足 $t_i \ge s_i$ 的下标 $i$ 的个数。如果 $a > b$,则响应为 “<”,否则响应为 “>=”。字符通过其 ASCII 码进行比较。

你需要猜测密码或判定其无法确定。

输入格式

第一行包含一个奇数 $n$ ($1 \le n < 100$):密码的长度。接下来的每一行包含对你检查查询的响应(“<” 或 “>=”)。

注意,答案仅在你的查询之后打印。

输出格式

你可以输出:

  • “? {n 个拉丁字母}” —— 你的查询。
  • “! {n 个拉丁字母}” —— 你的猜测。在你打印此内容后,程序必须立即终止。
  • “Impossible” —— 如果你认为无法可靠地确定密码。在你打印此内容后,程序必须立即终止。

记得在每次查询后刷新输出。

样例

输入格式 1

1
>=
>=
>=
<
<

输出格式 1

? Z
? Y
? X
? B
? W
! X

说明

注意,密码在你的程序运行前就已经确定,且不会改变。尽管如此,如果无法可靠地确定正确的密码,你也不允许猜测密码(即使猜对了也不行)。

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.