| 
 | 
вернуться в форумthis is a shape of sample#1: ('B'=Black, '.'=white) B...B .B... ..B..   you must count all the streak which not belong to the streak with size more than current streak, therefor the cell's (1,2) & (2,1) & (3,2) must'nt count because they are belong to streak (1,2)->(1,4) & (2,1)->(2,2) & (3,1)->(3,2).   here some test for problem: ////////////////////////// input: 5 5 2 1 2 3 3   output: 12 ////////////////////////// input: 5 5 4 1 2 5 3 3 1 4 4   output: 12 ////////////////////////// input: 1 1 0   output: 1 ////////////////////////// input: 1 1 1 1 1   output: 0 ///////////////////////// input: 5 5 12 1 2 1 4 2 1 2 3 2 5 3 2 3 4 4 1 4 3 4 5 5 2 5 4   output: 13 ////////////////////////////// I hope can help you. GOOD LUCK! I don't understand   this is a shape of sample#1: ('B'=Black, '.'=white) B...B .B... ..B..   I see 7 sreaks: 1) (2,1)->(3,1) 2) (3,1)->(3,2) 3) (1,2)->(1,4) 4) (2,3)->(2,5) 5) (1,4)->(3,4) 6) (3,4)->(3,5) 7) (2,5)->(3,5)   why 8!? +(1,3)-->(2,3) i think... Edited by author 28.12.2013 04:11   Edited by author 28.12.2013 04:55  |  
  | 
|