leo12334 @ 2023-01-01 16:30:54
求助各位大佬,为啥我把数组开到1001会有两个点RE,1005就没事呢
#include<bits/stdc++.h>
using namespace std;
int n,t,x,xx,y,yy,ans,a[1005][1005],d[1005][1005];
int main(){
cin>>n>>t;
for(int i=1;i<=t;i++){
cin>>x>>y>>xx>>yy;
d[x][y]++;d[xx+1][yy+1]++;
d[x][yy+1]--;d[xx+1][y]--;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
a[i][j]=a[i-1][j]+a[i][j-1]-a[i-1][j-1]+d[i][j];
cout<<a[i][j]<<' ';
}
cout<<endl;
}
}
by VitrelosTia @ 2023-01-01 16:33:46
@leo12334 因为你有+1
和-1
的操作。
by leo12334 @ 2023-01-01 16:39:35
@VT_SODC3DC3BSLF 嗷嗷我光注意a数组忘记看d数组了,谢谢大佬