记录编号 |
559960 |
评测结果 |
AAAAAAAAAA |
题目名称 |
知己知彼,百战不殆 |
最终得分 |
100 |
用户昵称 |
遥时_彼方 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.090 s |
提交时间 |
2021-03-31 18:48:51 |
内存使用 |
10.95 MiB |
显示代码纯文本
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
using namespace std;
int n[1801][1801];
int nc,mc;
int ans;
int mx;
int mj;
void ad(int x,int y)
{
n[x][y]++;
if(mx<n[x][y])
{
mx=n[x][y];
mj=1;
}
else if(mx==n[x][y]) mj++;
if(n[x][y]==1) ans++;
if(x-2>0&&y+1<=nc)
{
if(!n[x-2][y+1]) ans++;
n[x-2][y+1]++;
if(mx<n[x-2][y+1])
{
mx=n[x-2][y+1];
mj=1;
}
else if(mx==n[x-2][y+1]) mj++;
}
if(x-1>0&&y+2<=nc)
{
if(!n[x-1][y+2]) ans++;
n[x-1][y+2]++;
if(mx<n[x-1][y+2])
{
mx=n[x-1][y+2];
mj=1;
}
else if(mx==n[x-1][y+2]) mj++;
}
if(x+1<=nc&&y+2<=nc)
{
if(!n[x+1][y+2]) ans++;
n[x+1][y+2]++;
if(mx<n[x+1][y+2])
{
mx=n[x+1][y+2];
mj=1;
}
else if(mx==n[x+1][y+2]) mj++;
}
if(x+2<=nc&&y+1<=nc)
{
if(!n[x+2][y+1]) ans++;
n[x+2][y+1]++;
if(mx<n[x+2][y+1])
{
mx=n[x+2][y+1];
mj=1;
}
else if(mx==n[x+2][y+1]) mj++;
}
if(x+1<=nc&&y-2>0)
{
if(!n[x+1][y-2]) ans++;
n[x+1][y-2]++;
if(mx<n[x+1][y-2])
{
mx=n[x+1][y-2];
mj=1;
}
else if(mx==n[x+1][y-2]) mj++;
}
if(x-1>0&&y-2>0)
{
if(!n[x-1][y-2]) ans++;
n[x-1][y-2]++;
if(mx<n[x-1][y-2])
{
mx=n[x-1][y-2];
mj=1;
}
else if(mx==n[x-1][y-2]) mj++;
}
if(x-2>0&&y-1>0)
{
if(!n[x-2][y-1]) ans++;
n[x-2][y-1]++;
if(mx<n[x-2][y-1])
{
mx=n[x-2][y-1];
mj=1;
}
else if(mx==n[x-2][y-1]) mj++;
}
if(x+2<=nc&&y-1>0)
{
if(!n[x+2][y-1]) ans++;
n[x+2][y-1]++;
if(mx<n[x+2][y-1])
{
mx=n[x+2][y-1];
mj=1;
}
else if(mx==n[x+2][y-1]) mj++;
}
return;
}
int main()
{
freopen("safenum.in","r",stdin);
freopen("safenum.out","w",stdout);
cin>>nc>>mc;
int s1,s2;
for(int i=1;i<=mc;i++)
{
scanf("%d%d",&s1,&s2);
ad(s1,s2);
}
cout<<nc*nc-ans<<endl<<mx<<" "<<mj<<endl;
return 0;
}