QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 256 MB مجموع النقاط: 100 تفاعلية

#12825. 冷热游戏

الإحصائيات

这是一个交互式题目。

Small Tuple 和她的哥哥 Kortesh 生活在一个 $d$ 维世界中。今天他们决定玩捉迷藏——Kortesh 是第一个寻找者。由于在高维世界中找人通常是一项艰巨的任务,他们决定使用对讲机进行交流。此外,他们每个人都带了 GPS 接收器。

Tuple 躲在超立方体森林中的某一点,在 Kortesh 找到她之前不会移动。森林是一个边长为 $r$ 的超立方体,它包含了所有坐标为 $[0, r]$ 之间整数的 $d$ 维点。Kortesh 在森林中走动,并不时使用对讲机告诉 Tuple 他当前的位置。然后,Tuple 会回复一个单词:如果 Kortesh 自上次(即最近一次)交流以来离 Tuple 更近了,则回复 hotter,否则回复 colder

给定 $d$ 维点 $p, x, y$,Tuple 称 $x$ 比 $y$ 更靠近 $p$,如果: $$\max_{i=1,2,\dots,d} |x_i - p_i| < \max_{i=1,2,\dots,d} |y_i - p_i|$$

不幸的是,Kortesh 忘记给对讲机充电了,电池电量只允许他进行 $100d$ 次通信。请帮助他在失去联系能力之前找到他的妹妹。

交互

首先,你的程序应该从标准输入读取两个整数 $d$ 和 $r$(定义如上;$1 \le d \le 100$,$2 \le r \le 10^9$)。

然后,你的程序应使用标准输入和标准输出与 Tuple 进行通信。

Tuple 躲在一个坐标为整数的点上;每个坐标都在区间 $[0, r]$ 内。她从不移动,并且总是如实回答。

为了移动到点 $x = (x_1, \dots, x_d)$(其中每个 $x_i$ 都是 $[0, r]$ 之间的整数)并向 Tuple 报告该位置,请按以下格式打印一行:

? x1 x2 ... xd

之后,你可以从输入中读取 Tuple 的回复。回复总是由单行组成,包含一个单词,即 hottercolder。如果这是 Kortesh 第一次与 Tuple 通信,回复必然是 colder。否则,当且仅当点 $x$ 比 $x'$ 更靠近 Tuple 时,回复为 hotter,其中 $x'$ 是 Kortesh 上次通信时的位置。

你最多可以与 Tuple 通信 $100d$ 次。

一旦你确定 Tuple 的位置为 $p = (p_1, \dots, p_d)$,请按以下格式打印一行并终止你的程序:

! p1 p2 ... pd

打印每一行后,请务必刷新标准输出。

样例

输入格式 1

2 2
colder
colder
hotter
hotter

输出格式 1

? 2 2
? 0 0
? 1 1
? 2 2
! 2 2

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.