zlw233 @ 2020-09-13 17:37:32
#include<bits/stdc++.h>
using namespace std;
/*int read()
{
int r=0,f=1;char c=getchar();
while((c<'0'||c>'9')&&c!='-')c=getchar();
if(c=='-')
{
f=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
r=r*10+c-'0';
c=getchar();
}
return r*f;
}*/
int main()
{
int n,m,s[1001][1001];
int i,j,x1,x2,y1,y2;
cin>>n>>m;
for(i=1;i<=m;i++)
{
cin>>x1>>y1>>x2>>y2;
s[x1][y1]+=1;
s[x2+1][y1]-=1;
s[x1][y2+1]-=1;
s[x2+1][y2+1]+=1;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1];
cout<<s[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
by 幼儿园第一名 @ 2020-09-13 17:48:07
数组定义在主函数上面
by lyojoy @ 2020-09-13 18:27:04
爆内存了
by A_Pikachu @ 2020-09-13 18:39:01
<bits/stdc++.h>
头文件中不能声明变量名y1