CF128A.Statues
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 × 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has several statues. Each statue occupies exactly one square. A square that contains a statue cannot have anything or anyone — neither any other statues, nor Anna, nor Maria.
Anna is present on the board as a figurant (she stands still and never moves), and Maria has been actively involved in the game. Her goal is — to come to Anna's square. Maria and statues move in turn, Maria moves first. During one move Maria can go to any adjacent on the side or diagonal cell in which there is no statue, or she can stay in the cell where she is. The statues during their move must go one square down simultaneously, and those statues that were in the bottom row fall from the board and are no longer appeared.
At that moment, when one of the statues is in the cell in which the Maria is, the statues are declared winners. At the moment when Maria comes into the cell where Anna has been waiting, Maria is declared the winner.
Obviously, nothing depends on the statues, so it all depends on Maria. Determine who will win, if Maria does not make a strategic error.
本题中,安娜与玛丽亚正与一位非常讨厌的对手进行一场游戏。安娜与玛丽亚分别位于一个国际象棋棋盘(8×8)的对角位置:安娜位于右上角,玛丽亚位于左下角。除此之外,棋盘上还分布着若干座雕像。每座雕像恰好占据一个格子。含有雕像的格子是禁止进入的——既不能有其他雕像,也不能有安娜或玛丽亚。
安娜在本局中仅作为静态角色(她始终静止不动,不会移动),而玛丽亚则积极参与游戏。她的目标是抵达安娜所在的格子。玛丽亚与雕像轮流行动,玛丽亚先行。在一次行动中,玛丽亚可向其当前所在格子的任意一个上下左右或四个对角方向的相邻格子移动(前提是该格子内没有雕像),或者选择原地不动。雕像在它们的回合中必须同时向下移动一格;原本位于最底行(第 8 行)的雕像将移出棋盘,从此不再出现。
若在某一时刻,某座雕像移动后恰好落在玛丽亚所在的格子,则雕像方获胜;
若在某一时刻,玛丽亚成功移动至安娜所在的格子,则玛丽亚获胜。
显然,雕像的行为完全确定、毫无策略性,因此胜负完全取决于玛丽亚。假设玛丽亚不犯任何策略性错误,请判断最终谁将获胜。
输入格式
You are given the 8 strings whose length equals 8, describing the initial position on the board. The first line represents the top row of the board, the next one — for the second from the top, and so on, the last line represents the bottom row. Each character string matches a single cell board in the appropriate row, and the characters are in the same manner as that of the corresponding cell. If the cell is empty, the corresponding character is ".". If a cell has Maria, then it is represented by character "M". If a cell has Anna, it is represented by the character "A". If a cell has a statue, then the cell is represented by character "S".
It is guaranteed that the last character of the first row is always "A", the first character of the last line is always "M". The remaining characters are "." or "S".
给你 8 个长度均为 8 的字符串,用于描述棋盘上的初始局面。第一行表示棋盘的最上方一行,第二行表示从上往下数的第二行,以此类推,最后一行表示棋盘的最底行。每个字符串中的字符对应相应行中的单个棋盘格子,字符的顺序与格子位置一一对应。若格子为空,则对应字符为 .;若格子中有玛丽亚(Maria),则对应字符为 M;若格子中有安娜(Anna),则对应字符为 A;若格子中有一座雕像,则对应字符为 S。
保证第一行的最后一个字符恒为 A,最后一行的第一个字符恒为 M。其余字符仅为 . 或 S。
输出格式
If Maria wins, print string "WIN". If the statues win, print string "LOSE".
如果玛丽亚获胜,输出字符串 "WIN";如果雕像获胜,输出字符串 "LOSE"。
输入输出样例
输入#1
.......A ........ ........ ........ ........ ........ ........ M.......
输出#1
WIN
输入#2
.......A ........ ........ ........ ........ ........ SS...... M.......
输出#2
LOSE
输入#3
.......A ........ ........ ........ ........ .S...... S....... MS......
输出#3
LOSE
输入解题思路,AI测评打分。不知道怎么写?