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

建议使用的浏览器:

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

3451:Beat drop

题目描述
John recently found an interesting flash game on BBS. The game is mainly about making the best of the present waterdrops and use as little waterdrops as possible to eliminate all the
waterdrops on board.Now let’s briefly introduce the operations: The game board is a 6*6 square. At the beginning, there are waterdrops in some squares (in different sizes), gamers can obtain a larger waterdrop by adding little waterdrops to the square. When the number of little waterdrops in the square meets 4, the big waterdrop in the square breaks, producing 4 little waterdrops, in whatever circumstances, the broken waterdrop can only produce 4 little waterdrops, which then fly up, down left, right, four directions. When a little whatdrop meets a square that contains a waterdrop, it will be absorbed, and the one in the square will become larger, just the same as when you manually add one to the square. When multiple waterdrops arrive at (a square that contains a waterdrop) simultaneously, they will be absorbed by the square. If the waterdrop touch the edge of board, it disappears. Gamers hope to use the least waterdrops to eliminate the waterdrops on board, so they can make through more levels. For further details, please visit “flashempire”. John and other byr players are obsessed with the game, but he is just not good at it. It’s mainly because after he comes up with an order to add the waterdrop, he can’t imagine the layout. Now John needs your help. So you will be given a game board and how the waterdrops are distributed, and John will tell you how he is going to add the waterdrop, he hopes that you can tell him if it can make it through the level, if not, tell him what the board will be like at the end. We use a n*m square to represent the game board, and L to represent the up limit of the number of waterdrops each square can contain, the number of waterdrops in each square exceeds L, the drop breaks. And the broken water drop produces 4 little waterdrops that will fly in four directions in the same speed.
输入解释
The first line will contain an integer T indicating the number of test cases For each test case, it starts with three integers n, m, L, where n is the number of the rows, m is the number of the columns, L is the up limit of the number each square can contain. 1<= n, m <= 100,5 <= L<=10. Then follows a n*m matrix indicating the initial state of the game board, you are assured that every element is non-negative and no larger than L. After the matrix, there will be a number q, indicating how John is going to add the waterdrop at the qth step. John only adds waterdrop when it is stabel after putting last waterdrop. So q line follows, each contains two integers x,y indicating the location John adds waterdrop. 1<=x<=n,1<=y<=m.
输出解释
For every test case, output “YES” or “NO” first, indicating if John can make it the end of this stage, if it is “NO”, it is required to output a n*m matrix indicating the final state of the game board.
输入样例
3
2 2 2
2 0
0 0
1
1 1
2 2 2
2 0
0 0 
1
1 2
6 6 4
4 3 2 0 0 0
3 3 0 1 2 2
1 3 2 4 2 0
3 4 1 4 4 1
3 2 2 2 3 0
3 0 3 2 1 2
6
4 3
4 3
3 2
2 2
2 6
4 4
输出样例
YES
NO
2 1
0 0
NO
0 0 0 0 0 0 
0 0 0 0 0 0 
0 0 0 0 0 0 
0 0 0 0 0 0 
0 0 0 0 0 0 
0 0 0 0 4 4 
来自杭电HDUOJ的附加信息
Recommend

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

源链接: HDU-3451

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

共提交 0

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