UVa 201 - Squares

201 - Squares

 * http://acm.uva.es/p/v2/201.html

Summary
Bruteforce. Since $$N \leq 9$$, we can simply iterate all the possible squares.

Explanation
Since $$N \leq 9$$, we can use a $$O(N^4)$$ bruteforce algorithm and it should be okay.

Input
4 16 H 1 1 H 1 3 H 2 1 H 2 2 H 2 3 H 3 2 H 4 2 H 4 3 V 1 1 V 2 1 V 2 2 V 2 3 V 3 2 V 4 1 V 4 2 V 4 3 2 3 H 1 1 H 2 1 V 2 1 4 16 H 1 1 H 1 3 H 2 1 H 2 2 H 2 3 H 3 2 H 4 2 H 4 3 V 1 1 V 2 1 V 2 2 V 2 3 V 3 2 V 4 1 V 4 2 V 4 3 2 3 H 1 1 H 2 1 V 2 1 4 16 H 1 1 H 1 3 H 2 1 H 2 2 H 2 3 H 3 2 H 4 2 H 4 3 V 1 1 V 2 1 V 2 2 V 2 3 V 3 2 V 4 1 V 4 2 V 4 3 2 3 H 1 1 H 2 1 V 2 1

Output
Problem #1

2 square (s) of size 1 1 square (s) of size 2



Problem #2

No completed squares can be found.



Problem #3

2 square (s) of size 1 1 square (s) of size 2



Problem #4

No completed squares can be found.



Problem #5

2 square (s) of size 1 1 square (s) of size 2



Problem #6

No completed squares can be found.