P15158 [SWERC 2024] The Charioteer

题目描述

当你研究古希腊神话时,你偶然发现了赫利俄斯之子法厄同的传说。在被赫利俄斯认作儿子后,法厄同请求驾驶他的太阳车。尽管赫利俄斯警告只有他才能控制马匹,但他还是答应了,将战车的控制权交给了法厄同。 悲剧的是,法厄同失去了对战车的控制,战车过于接近地球并烧毁了它。 然而,你想知道故事是否可能有不同的结局。如果法厄同到达赫利俄斯的神庙,那么赫利俄斯本人就可以阻止战车。为此,你创建了一个符合故事的模型。 希腊可以表示为一个无限的二维网格,法厄同和他的战车从坐标 $(0,0)$ 出发,面向 $Ox$ 轴的正方向。赫利俄斯的神庙放置在这个二维网格上的未知位置 $(X,Y)$。最初,战车的速度 $V$ 为 $1$。 每个时间步,按顺序发生以下事件: 1. 法厄同执行以下三个动作之一:将战车向左转 90 度、继续向前、或将战车向右转 90 度; 2. 战车沿其面向的方向移动 $V$ 个单位; 3. $V$ 增加 $1$; 4. 神谕告诉法厄同他的位置与赫利俄斯神庙位置之间的曼哈顿距离。 $(X1, Y1)$ 和 $(X2, Y2)$ 之间的曼哈顿距离为 $|X1 - X2| + |Y1 - Y2|$。 如果速度达到 $2 \times 10^4$,战车将失控并过于接近地球。如果在某一步结束时,战车位于 $(X,Y)$,则战车被阻止。 #### 交互格式 这是一个交互问题。因此,本题不提供初始输入,你需要首先提出问题。 在每个步骤中,你必须打印一行来操作战车的方向。该行必须遵循描述:“?” 后跟一个换行,其中 $c$ 可以是 $L$(表示逆时针旋转)、$R$(表示顺时针旋转)或 $F$(表示保持方向不变)。如果不遵循此格式,你将收到 **WRONG-ANSWER** 的判定。 发送一行后,你必须始终刷新输出。否则,你将收到 **TIMELIMIT** 的判定。 然后,神谕会打印一个整数,你可以在标准输入中读取,表示你的新位置(在沿指定方向移动 $V$ 个单位后)与神庙之间的曼哈顿距离。$V$ 在更新你的位置后增加。 如果该距离为 $0$,则表示你已到达赫利俄斯的神庙,因此应立即停止交互(退出程序),收到 **ACCEPTED** 的判定。 注意,你必须在移动后位于神庙上,仅仅驾驶战车飞越神庙上方不算到达。 如果你的速度达到 $2 \times 10^4$,你将收到 **WRONG-ANSWER** 的判定。

输入格式

This is an interactive problem. As such, no initial input is provided in this problem, and you get to ask a question first. At each step, you must print a line to act on the direction of the chariot. This line must follow the description "?" followed by a newline, where $c$ is either $L$ to rotate counterclockwise, $R$ to rotate clockwise, or $F$ to keep the direction unchanged. If it does not respect this format, you will receive a **WRONG-ANSWER** verdict. After sending a line, you must always flush the output. Otherwise, you will get the verdict **TIMELIMIT**. The oracle then prints a single integer, that you can read on the standard input, denoting the Manhattan distance between your new position (after moving $V$ units in the specified direction) and the temple. $V$ is increased after updating your position. If this distance is $0$, it means you arrived to the temple of Helios and thus should stop interaction immediately (exiting your program), receiving an **ACCEPTED** verdict. Notice that you must be in the temple after your move, just flying above the temple with the chariot does not count. If your velocity ever reaches $2 \times 10^4$, you will receive the verdict **WRONG-ANSWER**.

输出格式

说明/提示

#### 示例交互 在本节中,为了阐明输入和输出应该是什么,“” 打印在你的程序应该输出的内容之前。不要在真实的输入/输出中包含这些字符。 在此示例中,赫利俄斯的神庙(你必须猜测其位置)位于 X=1, Y=5。左列是输入/输出。右列是请求的移动发生后战车的状态。 | 输入/输出 | 战车状态 | |:-:|:-:| | > ? F | 战车移动到 (1,0),方向 = 右,V = 2 | | < 5 | 从 (1,0) 到 (1,5) 的距离为 5 | | > ? L | 战车移动到 (1,2),方向 = 上,V = 3 | | < 3 | 从 (1,2) 到 (1,5) 的距离为 3 | | > ? F | 战车移动到 (1,5),方向 = 上,V = 4 | | < 0 | 成功 | #### 数据范围 - $|X| \leq 10^6$ - $|Y| \leq 10^6$ - $|V| \leq 2 \times 10^4$ 翻译由 DeepSeek 完成