有两个测试点RE了,但下载测试数据能运行,不懂,求救
查看原帖
有两个测试点RE了,但下载测试数据能运行,不懂,求救
1329095
Pigu_Code楼主2024/4/17 17:29
#include <iostream>

using namespace std;

bool a[105][105] = { false };

void fire(int x, int y,int n)
{
	a[n - y][x - 1] = true;
	for (int i = n - y - 2; i <= n - y + 2; ++i) a[i][x - 1] = true;
	for (int i = x - 3; i <= x + 1; ++i) a[n-y][i] = true;
	a[n - y - 1][x - 2] = a[n - y + 1][x - 2] = a[n - y + 1][x] = a[n - y - 1][x] = true;
}
void shiny_store(int x, int y,int n)
{
	a[n - y][x - 1] = true;
	for (int i = n - y - 2; i <= n - y + 2; ++i)
	{
		for (int j = x - 3; j <= x + 1; ++j)
		{
			a[i][j] = true;
		}
	}
}
int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	while (m--)
	{
		int x1, y1;
		cin >> x1 >> y1;
		fire(x1, y1,n);
	}
	while (k--)
	{
		int x2,y2;
		cin >> x2 >> y2;
		shiny_store(x2, y2,n);
	}
	//检查生怪点
	int cnt = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			if (!a[i][j]) cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}
2024/4/17 17:29
加载中...