题目链接
题目描述
输入格式
输出格式
输入样例
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
样例解释
- 覆盖第一个地毯后:
0 0 0 0 0
0 1 1 0 0
0 1 1 0 0
0 0 0 0 0
0 0 0 0 0
- 覆盖第二个地毯后:
0 0 0 0 0
0 1 1 0 0
0 1 2 1 1
0 0 1 1 1
0 0 1 1 1
- 覆盖第三个地毯后:
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
-
code
#include<iostream>
using namespace std;
int n, m;
int f[1010][1010];
int a[1010][1010];
int main()
{
cin >> n >> m;
int x1, x2, y1, y2;
for (int i = 1; i <= m; i++)
{
cin >> x1 >> y1 >> x2 >> y2;
for (int j = x1; j <= x2; j++)
for (int k = y1; k <= y2; k++)
f[j][k]++;
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
cout << f[i][j] << " ";
cout << endl;
}
return 0;
}