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

Squiggly Sudoku

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2280    Accepted Submission(s): 956


Problem Description
Today we play a squiggly sudoku, The objective is to fill a 9*9 grid with digits so that each column, each row, and each of the nine Connecting-sub-grids that compose the grid contains all of the digits from 1 to 9.
Left figure is the puzzle and right figure is one solution.

Now, give you the information of the puzzle, please tell me is there no solution or multiple solution or one solution.
 

Input
The first line is a number T(1<=T<=2500), represents the number of case. The next T blocks follow each indicates a case.
Each case contains nine lines, Each line contains nine integers.
Each module number tells the information of the gird and is the sum of up to five integers:
0~9: '0' means this gird is empty, '1' - '9' means the gird is already filled in.
16: wall to the up
32: wall to the right
64: wall to the down
128: wall to the left
I promise there must be nine Connecting-sub-grids, and each contains nine girds.
 

Output
For each case, if there are Multiple Solutions or no solution just output "Multiple Solutions" or "No solution". Else output the exclusive solution.(as shown in the sample output)
 

Sample Input
3 144 18 112 208 80 25 54 144 48 135 38 147 80 121 128 97 130 32 137 32 160 144 114 167 208 0 32 192 100 160 160 208 96 183 192 101 209 80 39 192 86 48 136 80 114 152 48 226 144 112 160 160 149 48 128 0 112 166 215 96 160 128 41 128 39 153 32 209 80 101 136 35 192 96 200 67 80 112 208 68 96 144 48 144 81 81 16 53 144 48 128 96 224 144 48 128 103 128 38 163 208 80 0 37 224 209 0 32 135 48 176 192 64 112 176 192 104 192 101 128 89 80 82 32 150 48 149 48 224 208 16 48 224 192 33 128 0 114 176 135 0 80 112 169 137 32 148 32 192 96 176 144 32 192 96 193 64 80 80 96 192 96 144 88 48 217 16 16 80 112 176 224 176 129 48 128 40 208 16 37 145 32 128 96 196 96 176 136 32 192 32 227 176 144 80 96 192 32 176 192 80 98 160 145 80 48 224 128 48 144 80 96 224 183 128 48 128 36 224 144 51 144 32 128 105 131 64 112 136 32 192 36 224 176 224 208 80 64 64 116 192 83 96
 

Sample Output
Case 1: 521439678 763895124 984527361 346182795 157964832 812743956 235678419 479216583 698351247 Case 2: No solution Case 3: Multiple Solutions
 

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-22 09:40:39, Gzip enabled