spoj:ASSIGN

Any one please explain this test case,unable to understand this problem:http://www.spoj.com/problems/ASSIGN/
1 
5 
1 1 0 1 0 
0 0 1 0 1 
1 1 1 0 0 
0 0 1 0 1 
1 1 1 0 1