比赛 |
202103省实验桐柏一中普及组联赛 |
评测结果 |
WEEEEEEEEE |
题目名称 |
知己知彼,百战不殆 |
最终得分 |
0 |
用户昵称 |
ZooxTark➲ |
运行时间 |
1.253 s |
代码语言 |
C++ |
内存使用 |
15.65 MiB |
提交时间 |
2021-03-22 19:20:02 |
显示代码纯文本
#include <iostream>
#include <cstdio>
#define MAXN 1800
using namespace std;
int x[MAXN],y[MAXN],area[MAXN][MAXN],poits[9];
int safe = 0;
int n,m,t;
bool can_go(int x,int y)
{
if(x >= 0 && x < n && y >= 0 && y < n)
{
return true;
}
else return false;
}
int main()
{
freopen("safenum.in","r",stdin);
freopen("safenum.out","w",stdout);
cin >> n >> m;
t = n-1;
safe = n * n;
for(int i = 0;i < m;i++)
{
cin >> x[i] >> y[i];
area[x[i]][y[i]]++;
if(can_go(x[i]-2,y[i]-1))
{
area[x[i]-2][y[i]-1]++;
}//
if(can_go(x[i]-1,y[i]-2))
{
area[x[i]-1][y[i]-2]++;
}//
if(can_go(x[i]+1,y[i]-2))
{
area[x[i]+1][y[i]-2]++;
}//
if(can_go(x[i]+2,y[i]-1))
{
area[x[i]+2][y[i]-1]++;
}//
if(can_go(x[i]+2,y[i]+1))
{
area[x[i]+2][y[i]+1]++;
}//
if(can_go(x[i]+1,y[i]+2))
{
area[x[i]+1][y[i]+2]++;
}//
if(can_go(x[i]-1,y[i]+2))
{
area[x[i]-1][y[i]+2]++;
}//
if(can_go(x[i]-2,y[i]+1))
{
area[x[i]-2][y[i]+1]++;
}//
}
for(int i = 0;i < n;i++)
{
for(int j = 0;j < n;j++)
{
if(area[i][j] > 0)
{
safe--;
poits[area[i][j]]++;
}
cout << area[i][j] << " ";
}
cout << endl;
}
cout << safe << endl;
for(int i = 8;i >= 0;i--)
{
if(poits[i] != 0)
{
cout << i << " " << poits[i];
return 0;
}
}
return 0;
}