#P3397. 地毯
地毯
Description
On an grid, there are carpets. Given the information of these carpets, determine how many carpets cover each cell.
Input Format
The first line contains two positive integers , as described above. Then follow lines. Each line gives two coordinates and , representing a carpet whose top-left corner is and bottom-right corner is .
Output Format
Output lines, each containing non-negative integers. The integer in row and column denotes how many carpets cover the cell .
5 3
2 2 3 3
3 3 5 5
1 2 1 4
0 1 1 1 0
0 1 1 0 0
0 1 2 1 1
0 0 1 1 1
0 0 1 1 1
Hint
Sample Explanation
After covering the first carpet:
After covering the first and second carpets:
After covering all carpets:
Constraints
For of the testdata, , . For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号