QOJ.ac

QOJ

時間限制: 2.0 s 記憶體限制: 512 MB 總分: 100

#18354. Premove Checkmate

统计

请注意,本题中的预设移动(premove)描述与某些流行国际象棋网站上使用的不同。

你在网上下一局国际象棋。你处于残局:你方有一个王和一个后,对方只有一个孤王。问题是,你的包干时间(clock time)所剩无几,不仅不够将死对手,甚至不够你手动做出任何一步移动。

幸运的是,游戏有预设移动(premove)功能。预设移动的机制如下:你在棋盘上输入一系列移动(这些可以是任意移动,仅由起点格和终点格描述,你的棋子不一定非要停留在起点格上)。这些移动会被存储在一个队列中。你只能在对手思考(即轮到对手移动)时向队列中添加移动。

然后,在对手做出一步移动后,如果你的预设移动队列不为空,队列中的移动会被依次弹出。如果弹出的移动是非法的,它就会被直接跳过;一旦弹出的移动是合法的,它就会立即在棋盘上执行,并且你的包干时间不会减少。

在当前局面中,你的王在 c3,你的后在 d4,而对手的王在棋盘右上角的某个格子(e5, e6, e7, e8, f5, f6, f7, f8, g5, g6, g7, g8, h5, h6, h7 或 h8)。你记不清它具体在哪个格子里了,因为你的时间太紧迫,而且你太紧张了!

现在轮到对手移动。由于你没有剩余时间,你必须输入一个预设移动队列,使得无论对手如何移动,都能直接将其将死。根据国际象棋规则,必须在 50 步以内(此规则仅计算你的移动)达成将死。预设移动队列最多可以存储 500 步移动——其中一些移动可能会因为非法而被跳过,因此不计入实际移动步数。

输入格式

本题没有输入。

输出格式

第一行输出一个整数 $k$($1 \le k \le 500$),表示预设移动队列中的移动步数。

接下来的 $k$ 行,每行输出一个形如 d4d5 的字符串,表示一步预设移动(起点格和终点格)。

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.