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

建议使用的浏览器:

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

3087:Aqua Splash

题目描述
Recently a game named Aqua Splash attracted ZWC especially. The way to play the game is simple:
Give you a n*n chessboard. At first there are some blisters(水泡) on some position of the chessboard. There are three kinds of blisters. They will contain 1, 2 or 3 globules(水珠).

Now ZWC can choose one grid which has a blister to click. When being clicked, the blister will add one globule. If the number of globules in one blister is not less than 4, the blister will burst and disappear. Meanwhile, it will splash into 4 globules to up, down, left, right direction. In each direction, the first blister that not burst will absorb the globule and its globules will add one. This action may cause new blisters’ burst. If all the blisters have burst, ZWC will win the game.

To simplify this problem, you may suppose the globules move very fast and every second divide into two parts, at first all blisters have not less than 4 globules will burst and splash globules. Then the blisters still not burst try to absorb these globules. The following second repeats the same action.
You can get more detailed information from the sample.

ZWC wants to know whether he could win the game by clicking only one of the blisters. Can you help him?
输入解释
The first line of the input is a single integer T which means the number of test cases.
Each test case starts with a line contains three numbers n (0 < n <= 20), the size of chessboard, x, y (1 <= x, y <= n) the grid that ZWC has clicked. Then n lines follow, each contains n integers. The integer aij (0<=aij <4) indicates the ith row and jth column of the chessboard has a blister with aij globules, aij = 0 means there isn’t exist a blister.
输出解释
For each case, print the case number followed by the answer of your program. If he can finish the game, please output: “Yes! Good job ZWC!” Or output: “No! Please try again ZWC!”. Just use the format as shown in the sample output.
输入样例
2
4 4 4
0 3 0 0
3 3 0 3
0 0 0 0
0 3 0 3
4 3 3
3 1 0 0
3 1 2 3
2 3 3 3
0 0 2 3
输出样例
Case 1: Yes! Good job ZWC!
Case 2: No! Please try again ZWC!
提示
In the first Case, the first burst blister is at (4, 4), and (4, 2) and (2, 4) are at second 2, 
(2, 2) are at second 3, (1, 2) and (2, 1) are at second 4.
In the second Case, (3, 3) is at second 1, (3, 2) and (3, 4) are at second 2, (2, 4) (3, 1) (4, 4) are at second 3, 
(2, 1) (2, 3) (4, 3) are at second 4, (1, 1) and (2, 2) are at second 5. the blister at (1, 2) will not burst.
来自杭电HDUOJ的附加信息
Author possessor WC
Recommend lcy

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

源链接: HDU-3087

最后修改于 2020-10-25T22:59:53+00:00 由爬虫自动更新

共提交 0

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