比赛 |
202103省实验桐柏一中普及组联赛 |
评测结果 |
AAAAAAAAAA |
题目名称 |
知己知彼,百战不殆 |
最终得分 |
100 |
用户昵称 |
yrtiop |
运行时间 |
0.170 s |
代码语言 |
C++ |
内存使用 |
13.85 MiB |
提交时间 |
2021-03-22 18:41:33 |
显示代码纯文本
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 2005;
int n,m;
bool judge(int x,int y) {
return x >= 1&&x <= n&&y >= 1&&y <= n;
}
int fx[] = {0 , 1 , 1 , 2 , 2 , -1 , -1 , -2 , -2};
int fy[] = {0 , 2 , -2 , 1 , -1 , -2 , 2 , 1 , -1};
int d[maxn][maxn];
int main() {
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);
for(int k = 0;k <= 8;++ k) {
int nx = x + fx[k];
int ny = y + fy[k];
if(!judge(nx , ny))continue ;
++ d[nx][ny];
}
}
int cnt = 0;
int ans = 0,cur = 0;
for(int i = 1;i <= n;++ i) {
for(int j = 1;j <= n;++ j) {
if(!d[i][j]) {
++ cnt;
continue ;
}
if(d[i][j] > ans) {
ans = d[i][j];
cur = 1;
continue ;
}
if(d[i][j] == ans) {
++ cur;
continue ;
}
}
}
printf("%d\n%d %d",cnt,ans,cur);
fclose(stdin);
fclose(stdout);
return 0;
}