请问各位佬,我这个E为什么只过了百分之九十?
#include <iostream>
#include<algorithm>
#include<vector>
#define ll long long
using namespace std;
int ans[1005][1005], m[1005][1005];
int tex[4][2] = { 0,1,1,0,0,-1,-1,0 }, bh = 0, res1 = 0;
int n;
bool u = false;
void dfs(int y, int x, int bm)
{
for (int i = 0; i <= 3; i++)
{
if (u) return;
int ty = y + tex[i][0], tx = x + tex[i][1];
if (ty<1 || ty>n || tx<1 || tx>n || ans[ty][tx] == 2 || m[ty][tx] == bm) continue;
if (ans[ty][tx] == 0) {
u = true;
return;
}
else if (ans[ty][tx] == 1)
{
res1++;
m[ty][tx] = bm;
dfs(ty, tx, bm);
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n;
for(int i=1;i<=n;i++)
for (int j = 1; j <= n; j++)
{
char x;
cin >> x;
if (x == '.') ans[i][j] == 0;
else if (x == '*')
ans[i][j] = 1;
else ans[i][j] = 2;
}
int res = 0;
for(int i=1;i<=n;i++)
{
for (int j = 1; j <= n; j++)
{
if (ans[i][j] == 0)
{
bh++;
int res2 = 0;
for (int v = 0; v < 4; v++)
{
int ty = i + tex[v][0], tx = j + tex[v][1];
if (ty<1 || ty>n || tx<1 || tx>n) continue;
if (ans[ty][tx] == 1)
{
if (m[ty][tx] == bh) continue;
ans[i][j] = 2;
u = false;
res1 = 1;
m[ty][tx] = bh;
dfs(ty, tx, bh);
if (!u) res2=res2+res1;
ans[i][j] = 0;
}
}
res = max(res, res2);
}
}
}
cout << res;
}