Binary Indexeed Tree short nice problem

Правка en2, от I_LOVE_ROMANIA, 2019-02-20 22:37:27

Hi! I encounter difficulties in finding a solution to this problem: having a matrix filled with 0 and 1, size N x N with N <= 1000, output the number of squares with the border filled with 1 (we are not interested in what's inside the square). We consider valid even the squares of size 1x1. For this example, the answer is 27. Can anybody help me? (sorry for the example, I don't know how to show the lines one above the others) 0000000 0111100 0101111 0100101 0111111 0000011 0000011

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский I_LOVE_ROMANIA 2019-02-20 22:37:27 81
en1 Английский I_LOVE_ROMANIA 2019-02-20 22:36:32 450 Initial revision (published)