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

建议使用的浏览器:

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

6660:Acesrc and Hunting

Special Judge 特殊评判
题目描述
Acesrc is a famous hunter at Nanjing University second to none. Recently, he set $n \times m$ traps in Yangshan Park, a park near Nanjing University Xianlin Campus, arranged in $n$ rows and $m$ columns. The rows are numbered $1$ through $n$ from bottom to up, and the columns are numbered $1$ through $m$ from left to right. The distance between two adjacent traps, both horizontally and vertically, is 1 meter.

Today, Acesrc happily finds that every trap he set has captured an animal. He decides to collect these hunted animals to make roast meat for his friends. However, collecting these animals normally is too boring, so he decides to find a route following the rules below:

1. Acesrc can choose any trap to start; every time he collects the animal in the trap, he moves to some unvisited trap and repeats until all captured animals are collected;
2. The Euclidean distance he moves from one trap to the next trap should be between 1 meter and 3 meters exclusive; that is, the distance should be strictly greater than 1 meter and strictly less than 3 meters.

Acesrc has quickly collected all animals. Roo wonders how Acesrc collected these animals, but Acesrc buttons up his lip. Can you give a possible route to collect all the animals?
输入解释
The first line of input consists of a single integer $T$ $(1 \leq T \leq 240)$, the number of test cases. Each test case is a single line of two integers $n, m$ $(1 \leq n, m \leq 100)$, denoting the size of the trap matrix.
输出解释
For each test case, if it is impossible to find any valid route, print NO in a single line; otherwise, print YES in one line, followed by $n \times m$ lines describing the route, each of these lines containing two integers $x, y$ $(1 \leq x \leq n, 1 \leq y \leq m)$, denoting the position of a trap visited. If multiple solutions exist, print any.
输入样例
2
2 2
2 3
输出样例
NO
YES
1 1
2 2
1 3
2 1
1 2
2 3
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6660

最后修改于 2020-10-25T23:33:16+00:00 由爬虫自动更新

共提交 0

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