20分,自己电脑上的和评测机上结果不一样
查看原帖
20分,自己电脑上的和评测机上结果不一样
1113551
wzy20110830楼主2024/3/1 21:58
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,k;
	cin >> n >> m >> k;
	bool p[n + 1][n + 1];
	for(int i = 1;i <= n;i++)
		for(int j = 1;j <= n;j++)
			p[i][j] = false;
	for(int i = 1;i <= m;i++)
	{
		int x1,y1;
		cin >> x1 >> y1;
		p[x1 - 2][y1] = true;
		p[x1 - 1][y1 - 1] = true;
		p[x1 - 1][y1] = true;
		p[x1 - 1][y1 + 1] = true;
		p[x1][y1 - 2] = true;
		p[x1][y1 - 1] = true;
		p[x1][y1] = true;
		p[x1][y1 + 1] = true;
		p[x1][y1 + 2] = true;
		p[x1 + 1][y1 - 1] = true;
		p[x1 + 1][y1] = true;
		p[x1 + 1][y1 + 1] = true;
		p[x1 + 2][y1] = true;
	}
	for(int i = 1;i <= k;i++)
	{
		bool x2,y2;
		cin >> x2 >> y2;
		for(int j = -2;j <= 2;j++)
			for(int l = -2;l <= 2;l++)
				p[x2 + j][y2 + l] = true;
	}
	int ctr = 0;
	for(int i = 1;i <= n;i++)
		for(int j = 1;j <= n;j++)
			if(p[i][j] == false)	ctr++;
	cout << ctr; 
	return 0;
}
2024/3/1 21:58
加载中...