40分!!!
查看原帖
40分!!!
1037359
wmbwww楼主2023/9/5 19:38

2RE,1WRONG

#include <bits/stdc++.h>
using namespace std;
int a[110][110], n, m, k, x, y, o, p, cnt;

int main() {
	cin >> n >> m >> k;
	for (int i = 1; i <= m; i++) {
		cin >> x >> y;
		a[x - 1][y] = 1;
		a[x - 2][y] = 1;
		a[x + 1][y] = 1;
		a[x + 2][y] = 1;
		a[x][y + 1] = 1;
		a[x][y + 2] = 1;
		a[x][y - 1] = 1;
		a[x][y - 2] = 1;
		a[x - 1][y - 1] = 1;
		a[x + 1][y - 1] = 1;
		a[x - 1][y + 1] = 1;
		a[x + 1][y + 1] = 1;
	}
	for (int i = 1; i <= k; i++) {
		cin >> o >> p;
		for (int j = o - 2; j <= o + 2; j++) {
			for (int h = p - 2; h <= p + 2; h++) {
				a[j][h] = 1;
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (a[i][j] == 0) {
				cnt++;
			}
		}
	}
	cout << cnt;
	return 0;
}
2023/9/5 19:38
加载中...