比赛 |
202103省实验桐柏一中普及组联赛 |
评测结果 |
AAAAAAAAAA |
题目名称 |
知己知彼,百战不殆 |
最终得分 |
100 |
用户昵称 |
fsdh |
运行时间 |
0.155 s |
代码语言 |
C++ |
内存使用 |
14.13 MiB |
提交时间 |
2021-03-22 20:20:44 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1805;
int n, m, g[MAXN][MAXN], mnm = 0, s, d[8][2] = {{1, 2}, {-1, 2}, {2, 1}, {-2, 1}, {1, -2}, {-1, -2}, {2, -1}, {-2, -1}}, b;
int main () {
memset (g, 0, sizeof (g));
freopen ("safenum.in", "r", stdin);
freopen ("safenum.out", "w", stdout);
scanf ("%d%d", &n, &m);
s = n * n;
b = s;
for (int q = 1, x, y; q <= m; ++q) {
scanf ("%d%d", &x, &y);
g[x][y] ++;
if (g[x][y] == 1) b --;
if (g[x][y] > mnm) {
mnm = g[x][y];
s = 1;
}
else if (g[x][y] == mnm) s ++;
for (int w = 0; w < 8; ++w) {
int xx = x + d[w][0], yy = y + d[w][1];
if (xx < 1 || xx > n || yy < 1 || yy > n) continue;
g[xx][yy] ++;
if (g[xx][yy] == 1) b --;
if (g[xx][yy] > mnm) {
mnm = g[xx][yy];
s = 1;
}
else if (g[xx][yy] == mnm) s ++;
}
}
printf ("%d\n%d %d\n", b, mnm, s);
return 0;
}