【CF 1049B】Yet Another Crosses Problem
(以下代码时间超限了,我还不怎么会估算时间复杂度~~~~~~~)
(下面代码的思路是:遍历整个二维数组,依次枚举每个点,计数每个点上下左右的 . 的数量)。
如代码里的一段注释:memset函数,最后一个参数只能写成sizeof()的形式,不能写成整数值,否则置入数值时会出错。
#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
const int maxn=5*(1e4);
string ch[maxn];
int s[4],Min=1e5;
int n,m;
int up(int x,int y)
{
while(x>=0)
{
if(ch[x][y]=='.') s[0]++;
x--;
}
return s[0];
}
int down(int x,int y)
{
while(x<n)
{
if(ch[x][y]=='.') s[1]++;
x++;
}
return s[1];
}
int right(int x,int y)
{
while(y<m)