比赛 202103省实验桐柏一中普及组联赛 评测结果 AAAAAAAAAA
题目名称 知己知彼,百战不殆 最终得分 100
用户昵称 tb_PYD1 运行时间 0.149 s
代码语言 C++ 内存使用 12.91 MiB
提交时间 2021-03-22 18:09:40
显示代码纯文本
#include <cstdio>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

inline int max(int a,int b) {return a > b ? a : b;}

inline int read(){
	int t = 0,flag = 1;
	register char c = getchar();
	while (c < 48 || c > 57) flag = (c == '-') ? (-1) : (flag),c = getchar();
	while (c >= 48 && c <= 57) t = (t << 1) + (t << 3) + (c ^ 48),c = getchar();
	return flag * t;
}

int n,m,x,y,ans1,maxx = -1,ans2,mp[1801][1801],dx[9] = {-2,-1,1,2,2,1,-1,-2,0},dy[9] = {-1,-2,-2,-1,1,2,2,1,0};

inline void work(int x,int y){
	for (int i = 0;i <= 8;i++){
		int xx = x + dx[i],yy = y + dy[i];
		if (xx < 1 || xx > n || yy < 1 || yy > n) continue;
		++mp[xx][yy];
	}
}

int main(){
	freopen("safenum.in","r",stdin);
	freopen("safenum.out","w",stdout);
	n = read(),m = read();
	for (int i = 1;i <= m;i++) x = read(),y = read(),work(x,y);
	for (int i = 1;i <= n;i++){
		for (int j = 1;j <= n;j++){
			if (!mp[i][j]) ++ans1;
			if (mp[i][j] > maxx) maxx = mp[i][j],ans2 = 1;
			else if (mp[i][j] == maxx) ++ans2;
		}
	}
	printf("%d\n%d %d\n",ans1,maxx,ans2);
	fclose(stdin);
	fclose(stdout);
	return 0;
}