洛谷3397 地毯
int c[1005][1005];
int main() {
int n, m; cin >> n >> m;
int x1, x2, y1, y2;
while(m --) {
cin >> x1 >> y1 >> x2 >> y2;
for(int i = x1; i <= x2; i ++) {
c[i][y1] ++;
c[i][y2 + 1] --;
}
}
for(int i = 1; i <= n; i ++) {
for(int j = 1; j <= n; j ++) {
c[i][j] += c[i][j - 1];
cout << c[i][j] << " ";
}
cout << '\n';
}
return 0;
}