Problem 1701. Solve the picross! (Hard)
Solve the picross!
http://en.wikipedia.org/wiki/Nonogram
The arguments (horz and vert) are cells containing the clues, e.g:
horz = { 2, [1, 1], [] }; vert = { 2, 1, 1 };
means

You have to return the completed picross, a logical or double matrix with a 0 for a white case and a 1 for a black case. If we solve the previous example:

So, the output argument should be:
picross = [ 1 1 0 ; 1 0 1 ; 0 0 0 ];
You have to do some guessings and optimize your code to pass the test suite.
Have fun!
See also: http://www.mathworks.fr/matlabcentral/cody/problems/1700-solve-the-picross-easy
Solution Stats
Problem Comments
-
3 Comments
A good challenging task. Very nice input format of cell arrays.
Solving a grid of 75x60 squares within Cody's time limit is extra hard. The greatest challenge is to find a fast code; recursion with backtracking no longer seems like a viable option. And I do hope the author is aware that nonograms are an NP-hard problem, which means there is no known fast algorithm to solve the general case: we have to build one for the specific cases of the test suite.
To any new challengers, know that only logic will not solve these puzzles. You will need some guessing, which means make the computer solve it as far as it can and then you, yes YOU, look at the picture (we humans can recognize the shape and finish the puzzle; the computer not so much). And, please, fell free to try some solvers out there.
Solution Comments
Show commentsGroup

Computational Geometry II
- 20 Problems
- 18 Finishers
- Dots in a Diamond
- Property dispute!
- Shifted Hexagonal Tiling Dots in a Circle
- Hexagonal Tiling Dots in a Circle
- Dots in a Sphere
- Triangular Tiling Dots in a Circle
- Beads on a Necklace (Convex Hulls)
- Minimum Distance between two N-sided Polygons
- Minimum Distance Point to Segment
- Dots in a Circle
- Edges of a n-dimensional Hypercube
- Volume of a Simplex
- Find the optimal shape to bring the maximum product by a given perimeter
- Number of lattice points within a circle
- Points on a circle.
- Perimeter
- Geometry: Find Circle given 3 Non-Colinear Points
- Points on a Sphere
- Volume difference between Ellipsoid and Sphere
- Property dispute!
- Crossing to Kissing - Untangle the Lines
Problem Recent Solvers4
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!