In the middle of the SRM the problem description was updated. The grid is now limited with 12x12 instead of 14x14. But system tests have a test case with a grid 14x14.
grid will contain between 1 and 12 elements, inclusive.
The length of each element of grid will be between 1 and 12, inclusive.
Is it OK? Can anybody clarify the situation?
My solution failed to pass this test, but if I change 12 to 14 in the code it passes all test cases.