60pts, 求助!!!#2 #3 RE
查看原帖
60pts, 求助!!!#2 #3 RE
1031647
IeoA楼主2023/7/18 15:17
#include <bits/stdc++.h>
using namespace std;

int __map[105][105] = {0}, n, m, k, a, b, ans;

void torch (int x, int y) {
	__map[x][y]++;
	__map[x + 1][y]++, __map[x - 1][y]++;
	__map[x][y + 1]++, __map[x][y - 1]++;
	__map[x + 1][y + 1]++, __map[x - 1][y + 1]++;
	__map[x + 1][y - 1]++, __map[x - 1][y - 1]++;
	__map[x + 2][y]++, __map[x - 2][y]++;
	__map[x][y + 2]++, __map[x][y - 2]++;
}


void fluorite (int x, int y){
	int l1 = y - 2, r1 = y + 2;
	int l2 = x - 2, r2 = x + 2;
	for(int i = l1; i <= r1; i++){
		for(int j = l2; j <= r2; j++){
			__map[i][j]++;
		}
	}
}

int main() {
	cin >> n >> m >> k;
	for(int i = 1; i <= m; i++){
		cin >> a >> b;
		torch(a, b);
	}
	for(int i = 1; i <= k; i++){
		cin >> a >> b;
		fluorite(a, b);
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(__map[i][j] == 0){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}
2023/7/18 15:17
加载中...