#2#3两个RE求助大佬!!
查看原帖
#2#3两个RE求助大佬!!
688247
liyihan1025楼主2022/3/18 19:46
#include<bits/stdc++.h>
using namespace std;
bool a[1005][1005];
struct tor{
	int xi,yi;
};
struct flu{
	int xi,yi;
};
tor b[1000005];
flu c[1000005];
int main(){
	int n,m,s;
	cin>>n>>m>>s;
	for(int i=1;i<=m;i++){
		cin>>b[i].xi>>b[i].yi;
		a[b[i].xi+2][b[i].yi]=true;
		a[b[i].xi-2][b[i].yi]=true;
		a[b[i].xi][b[i].yi+2]=true;
		a[b[i].xi][b[i].yi-2]=true;
		for(int j=-1;j<=1;j++){
			for(int k=-1;k<=1;k++){
				a[b[i].xi+j][b[i].yi+k]=true;
			}
		}
	}
	for(int i=1;i<=s;i++){
		cin>>c[i].xi>>c[i].yi;
		for(int j=-2;j<=2;j++){
			for(int k=-2;k<=2;k++){
				a[c[i].xi+j][c[i].yi+k]=true;
			}
		}
	}
	int cnt=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(!a[i][j]) cnt++;
		}
	}
	cout<<cnt;
	return 0;
}
2022/3/18 19:46
加载中...