Change Elements in 2D Matrix

code: https://ide.codingblocks.com/s/594762
ques: https://hack.codingblocks.com/app/contests/2439/2031/problem

I am not able to get line no. 15. Are you making each element of matrix =0 or creating a new array and making it 0? why are we doing this