CF1557E.Assiut Chess
省选/NOI-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This is an interactive problem.
ICPC Assiut Community decided to hold a unique chess contest, and you were chosen to control a queen and hunt down the hidden king, while a member of ICPC Assiut Community controls this king.
You compete on an 8×8 chessboard, the rows are numerated from top to bottom, and the columns are numerated left to right, and the cell in row x and column y is denoted as (x,y).
In one turn you can move the queen to any of the squares on the same horizontal line, vertical line, or any of the diagonals. For example, if the queen was on square (4, 5), you can move to (q1, 5), (4, q1), (q1, 9−q1), or (q2, q2+1) where (1≤q1≤8, q1=4, 1≤q2≤7, q2=4). Note that the queen cannot stay on its current cell.

In one turn, the king can move "Right", "Left", "Up", "Down", "Down-Right", "Down-Left", "Up-Left", or "Up-Right" such that he doesn't get out of the board. The king cannot move into a cell that is on the same row, column or diagonal with the queen (including the position of the queen itself). For example, if the king was on square (4, 5), he can move to (4+k1, 5+k2) where (−1≤k1,k2≤1, (k1,k2)=(0,0)).

At the start of the game, you should place the queen at any location on the board, and this is done once per game. After that the king is secretly placed at any cell different from the queen's location. You do not know the position of the king. Then, the king and the queen take turns with the king moving first. The king moves to one of the possible directions ("Right", "Down", "Up-Left", etc.), and you are only given the direction it moves to. After that, you should move your queen by declaring the square to which your queen will move. The game follows like this until you win the game or run out of moves.
You win if the king has no valid moves. You lose if after 130 moves of the queen the king still has valid moves.
这是一个交互式问题。
ICPC 阿斯尤特社区决定举办一场独特的国际象棋比赛,你将操控一枚皇后(Queen)来追捕隐藏的国王(King),而一名 ICPC 阿斯尤特社区成员则操控该国王。
你们在一块 8×8 的棋盘上进行对弈:行从上到下编号,列从左到右编号;位于第 x 行、第 y 列的格子记作 (x,y)。
每回合,你可以将皇后移动至同一水平线、同一竖直线或任意一条对角线上的任意一个格子。例如,若皇后位于格子 (4,5),则你可以将其移至 (q1,5)、(4,q1)、(q1,9−q1) 或 (q2,q2+1),其中 1≤q1≤8、q1=4、1≤q2≤7、q2=4。注意:皇后不能停留在当前格子。

每回合,国王可向“右”、“左”、“上”、“下”、“右下”、“左下”、“左上”或“右上”方向移动一格,但不得移出棋盘边界;且国王不能移动至与皇后处于同一行、同一列或同一条对角线上的格子(包括皇后所在格子本身)。例如,若国王位于格子 (4,5),则它可移至 (4+k1,5+k2),其中 −1≤k1,k2≤1,且 (k1,k2)=(0,0)。

游戏开始时,你须将皇后置于棋盘上任意一个位置,此操作每局仅执行一次。随后,国王被秘密放置于棋盘上除皇后所在格子外的任一格子中;你无法得知国王的具体位置。接着,国王与皇后轮流行动,国王先行。国王朝某个合法方向(如“右”、“下”、“左上”等)移动一格,你仅获知其移动方向;之后,你需声明皇后将要移动至的目标格子。如此循环往复,直至你获胜或用尽所有步数。
若国王无合法移动,则你获胜;若在皇后完成 130 步移动后,国王仍有合法移动,则你失败。
输入格式
The first line contains a single integer t (1≤t≤60) — the number of test cases.
第一行包含一个整数 t(1≤t≤60)—— 测试用例的数量。
输入输出样例
输入#1
1 Left Right Done
输出#1
7 5 7 6 7 7
说明/提示
In the example, the hidden king was at (8,8) at the start. The game follows like this:


在示例中,隐藏的国王初始位置为 (8,8)。游戏过程如下:


输入解题思路,AI测评打分。不知道怎么写?