记录编号 571697 评测结果 AAAAAAAAAA
题目名称 知己知彼,百战不殆 最终得分 100
用户昵称 Gravatar锝镆氪锂铽 是否通过 通过
代码语言 C++ 运行时间 0.122 s
提交时间 2022-06-11 23:12:40 内存使用 9.12 MiB
显示代码纯文本
#include <iostream>
#include <cstdio>
using namespace std;
const int MAXM = 1810;
int var[10][2] = {{-2, -1}, {-1, -2}, {0, 0}, {1, -2}, {2, -1},\
				{-1, 2}, {-2, 1}, {1, 2}, {2, 1}};

int n, m, tot, biggest, bignum;
int a[MAXM][MAXM] = {};
int main(void){
	freopen("safenum.in", "r", stdin);
	freopen("safenum.out", "w", stdout);
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; i ++){
		int x, y;
		scanf("%d%d", &x, &y);
		x += 2, y += 2;
		for (int j = 0; j <= 8; j ++)
			a[x + var[j][0]][y + var[j][1]] ++; 
	}
	for (int i = 1; i <= n; i ++)
		for (int j = 1; j <= n; j ++){
			tot += (!a[i + 2][j + 2]);
			a[i + 2][j + 2] > biggest ? biggest = a[i + 2][j + 2], bignum = 1 : bignum += (biggest == a[i + 2][j + 2]);
		}
	printf("%d\n%d %d", tot, biggest, bignum);
	return 0;
}