记录编号 181116 评测结果 TATAA
题目名称 爱上捉迷藏 最终得分 60
用户昵称 GravatarNVIDIA 是否通过 未通过
代码语言 C++ 运行时间 0.004 s
提交时间 2015-08-22 17:18:39 内存使用 0.39 MiB
显示代码纯文本
#include<cstdio>
#include<iostream>
using namespace std;

int n,m;
int maxx;
int jli,jlj;
int f[101][101];
int h[101][101];

int main()
{
	freopen("kadun.in","r",stdin);
	freopen("kadun.out","w",stdout);
	ios::sync_with_stdio(false);
	cin>>m>>n;
	for(int i=1;i<=n;i++)
	{
		string s;
		cin>>s;
		for(int j=0;j<m;j++)
		{
			if(s[j]=='X') f[i][j+1]=4;//可能 
			if(s[j]=='N') f[i][j+1]=3;//7*7
			if(s[j]=='C') f[i][j+1]=2;//5*5
			if(s[j]=='Z') f[i][j+1]=1;//3*3
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(f[i][j]==4) continue;
			int l=max(1,j-f[i][j]),r=min(m,j+f[i][j]);
			int u=max(1,i-f[i][j]),d=min(n,i+f[i][j]);
			for(int dx=u;dx<=d;dx++)
			{
				for(int lxx=l;lxx<=r;lxx++)
					if(f[dx][lxx]==4)
					{
						h[dx][lxx]++;
						if(h[dx][lxx]>maxx)
						{
							maxx=h[dx][lxx];
							jli=dx;
							jlj=lxx;
						}
					}
			}
		}
	}
	cout<<jlj<<' '<<jli;
	return 0;
}