F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Aqua Splash

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 441    Accepted Submission(s): 87


Problem Description
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?
 

Input
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.
 

Output
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.
 

Sample Input
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
 

Sample Output
Case 1: Yes! Good job ZWC! Case 2: No! Please try again ZWC!
 

Hint

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.
 

Author
possessor WC
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-26 00:58:31, Gzip enabled