Skip to main content

One post tagged with "BFS"

View All Tags

Question description

There is a grid with HH rows and WW columns. The cell at the ii-th row from the top and jj-th column from the left, denoted as (i,j)(i, j), contains the integer A[i][j]A[i][j].

For all cells (i,j)(i, j) where 1iH1 \leq i \leq H and 1jW1 \leq j \leq W, find the following value:

  • The sum of integers written in the cells that are in the same row or the same column as cell (i,j)(i, j) (including the cell itself).

CloverAlgorithmAtcoderGraphBFS2 min read