Double Chocolate, or Double Choco, is a logic puzzle on a grid. Each cell is colored either white or gray, and some cells contain a positive integer. The player must divide the entire grid into one or more regions, satisfying all the rules below:
The following is an example Double Chocolate puzzle with its solution.
The following are examples of non-solutions.
Given a Double Chocolate puzzle and a proposed solution, determine if the proposed solution is correct.
The first line contains an even integer , the size of the square grid. ()
The next lines describe a Double Chocolate puzzle. The first lines contain the color information: the -th number of the -th line is 1 if the cell at row and column is gray, and 0 if white.
If the proposed solution is indeed a valid solution to the puzzle, output 1. Otherwise, output 0.
The next line contains , the number of cells with a number. Each of the next lines contain the row number , the column number , and the number on it . (, )
The puzzle may have zero, one, or many valid solutions.
The next lines describe a proposed solution to the given puzzle, in the form of an ASCII art of size . This ASCII art satisfies the following:
+. They represent the corners of the square cells... They represent the interiors of the square cells.- if a border is drawn, . otherwise. The even-th characters of the first and last rows are all -.| if a border is drawn, . otherwise. The first and last characters of the even-th rows are all |.