当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7132:Occupying Grids

题目描述
Little Rabbit and Little Horse are playing a game called $\textit{Occupying Grids}$. The game is played on a square grid graph which has $m$ dots each row and $n$ dots each column. The players take turns to draw a segment that connects two adjacent dots. Once the four sides of a grid are all drawn, the player who draws the last side of the grid can occupy the grid and $\textbf{immediately}$ get one more chance to draw another segment. (Sometimes two grids can be occupied at the same time, but the player also gets $\textbf{only one}$ more chance to draw.) The game ends when no more segments can be drawn, and the player who occupies more grids will win the game. (Two players occupying the same number of grids results in a tie.) The picture below shows a game in a $3 \times 3$ square grid graph.






Little Rabbit and Little Horse both play the game for the first time. So in the beginning, they just draw the segments willy-nilly without any strategies. But after $k$ steps, they are surprised to find that each grid has $\textbf{at least 2}$ sides that are drawn. Little Rabbit wants to know whether he can win the game if both players play optimally from now on.

Little Rabbit cannot solve the problem, so he turns to you and shows you the $k$ steps $\textbf{in order}$. But he forgets to note down which player each step belongs to, so you need to judge by yourself. The only thing you know is that the first step belongs to Little Rabbit.

Please note that the $k$ steps given should strictly follow the rules. For example, if one player occupies a grid in some step, then the next step also belongs to him.
输入解释
The first line of the input contains an integer $T$ ($1 \le T \le 50$), indicating the number of test cases.

The first line of each test case contains three integers $n,m,k$ ($2 \le n,m \le 100$, $1 \le k \le 2nm-n-m$), indicating the number of rows and columns of the square grid graph, and the number of steps Little Rabbit shows you.

Then in the next $k$ lines, each line contains three integers $x,y,o$ ($1 \le x \le n$, $1 \le y \le m$, $0 \le o \le 1$) to describe a step. Here we use $(x,y)$ to describe the point in the $x$-th row and the $y$-th column.

- $\texttt{x y 0}$ ($1 \le x \le n$, $1 \le y < m$): a segment that connects $(x,y)$ and $(x,y+1)$.
- $\texttt{x y 1}$ ($1 \le x < n$, $1 \le y \le m$): a segment that connects $(x,y)$ and $(x+1,y)$.

The first step belongs to Little Rabbit. It is guaranteed that after the $k$ steps, each grid has at least $2$ sides that are drawn. It is also guaranteed that any two steps are different.
输出解释
For the $x$-th test case, if Little Rabbit wins, output $\texttt{Little Rabbit}$ in a single line. If Little Horse wins, output $\texttt{Little Horse}$ in a single line. If the game ends in a tie, output $\texttt{Tie}$ in a single line.
输入样例
3
3 3 8
1 1 0
1 2 0
2 1 0
2 2 0
3 1 0
3 2 0
1 3 1
2 1 1
3 3 8
1 1 0
1 1 1
1 2 0
1 3 1
2 1 1
2 3 1
3 1 0
3 2 0
3 3 6
1 1 0
1 2 0
2 1 0
2 2 0
3 1 0
3 2 0
输出样例
Little Rabbit
Little Horse
Tie
来自杭电HDUOJ的附加信息
Hint We use solid lines to indicate Little Rabbit's step and dashed lines to indicate Little Horse's step. The first test case of the sample input can be shown as follow.And now it is Little Rabbit's turn. It's obvious that Little Rabbit can occupy all the grids by the following steps.The second test case of the sample input can be shown as follow.And now it is Little Rabbit's turn. He has no choice but to draw one of the four sides in the middle. Then Little Horse can occupy all the grids.

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7132

最后修改于 2021-10-23T19:11:38+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 262144/262144K(Java/Others)