2D range update - MarisaOJ: Marisa Online Judge

2D range update

Time limit: 1000 ms
Memory limit: 256 MB
Given an 2D array $A$ having $n$ rows and $m$ columns only consists of zeros. You are also given $q$ queries, each of the form $(a, b, c, d)$ means to increment every elements $A_{i, j}$ that $a \le i \le c$ and $b \le j \le d$. ### Input - The first line contains 3 integers $n, m, q$. - Next $q$ lines, each line contains 4 integers $a, b, c, d$. ### Output - Print $n$ lines, each line contains $m$ integers representing $A$ after $q$ queries. ### Constraints - $1 \le n, m \le 1000$. - $1 \le q \le 10^5$. - $1 \le a, c \le n$. - $1 \le b, d \le m$. ### Example Input: ``` 3 3 2 1 2 3 3 2 1 3 2 ``` Output: ``` 0 1 1 1 2 1 1 2 1 ```