五月模拟c++
第一题为什么只能过60%
```
const int N = 1010;
int m[N][N];
int dp[N][N];
int main(){
int n;
cin>>n;
int maxx = 0,maxy = 0;;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
maxx = max(x,maxx);
maxy = max(y,maxy);
m[x][y] = 1;
}
for(int i=1;i<=maxx;i++){
for(int j=1;j<=maxy;j++){
dp[i][j] = dp[i-1][j]+dp[i][j-1]+m[i][j]-dp[i-1][j-1];
}
}
int m;
cin>>m;
for(int i=0;i<m;i++){
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
int area = dp[x2][y2]-dp[x1-1][y2]-dp[x2][y1-1]+dp[x1-1][y1-1];
cout<<area<<endl;
}
return 0;
}
int m[N][N];
int dp[N][N];
int main(){
int n;
cin>>n;
int maxx = 0,maxy = 0;;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
maxx = max(x,maxx);
maxy = max(y,maxy);
m[x][y] = 1;
}
for(int i=1;i<=maxx;i++){
for(int j=1;j<=maxy;j++){
dp[i][j] = dp[i-1][j]+dp[i][j-1]+m[i][j]-dp[i-1][j-1];
}
}
int m;
cin>>m;
for(int i=0;i<m;i++){
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
int area = dp[x2][y2]-dp[x1-1][y2]-dp[x2][y1-1]+dp[x1-1][y1-1];
cout<<area<<endl;
}
return 0;
}
```
#笔试题目#