记录编号 |
559773 |
评测结果 |
AAAAAAAAAA |
题目名称 |
知己知彼,百战不殆 |
最终得分 |
100 |
用户昵称 |
䱖虁職 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.114 s |
提交时间 |
2021-03-24 18:35:59 |
内存使用 |
12.52 MiB |
显示代码纯文本
- #include<bits/stdc++.h>
- using namespace std;
- int a[1801][1801]={0},n,m,ans=0,maxx=0,tot=0,tx[9]={0,1,2,2,1,-1,-2,-2,-1},ty[9]={0,2,1,-1,-2,-2,-1,1,2};
- int judge(int x,int y)
- {
- if(x<=n&&x>=1&&y<=n&&y>=1)
- return 1;
- return 0;
- }
- 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);
- a[x][y]++;
- for(int j=1;j<=8;j++)
- {
- if(judge(x+tx[j],y+ty[j]))
- {
- a[x+tx[j]][y+ty[j]]++;
- }
- }
- }
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=n;j++)
- {
- if(a[i][j]!=0)
- {
- ans++;
- if(a[i][j]==maxx)
- {
- tot++;
- }
- else
- {
- if(a[i][j]>maxx)
- {
- tot=1;
- maxx=a[i][j];
- }
- }
- }
- }
- }
- ans=n*n-ans;
- printf("%d\n",ans);
- printf("%d %d",maxx,tot);
- return 0;
- }