For each query, loop through all elements in the rectangle and sum them.
A rectangle can have up to elements. With queries, that's .
For a matrix with queries, you'd access million elements. Too slow.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
The trap
For each query, loop through all elements in the rectangle and sum them.
A rectangle can have up to elements. With queries, that's .
For a matrix with queries, you'd access million elements. Too slow.