提交后显示89分,差第四个数据点,但下载后在Dev-C++运行时输出与标准答案相同,都是输出72,这是怎么回事
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
char c[15][15];
int ls, lt, ans;
pii s, t;
bool vis[160005];
bool chk(int x, int y){
return x >= 1 && x <= 10 && y >= 1 && y <= 10 && c[x][y] != '*';
}
int main(){
for(int i = 1; i <= 10; i++)
for(int j = 1; j <= 10; j++){
cin >> c[i][j];
if(c[i][j] == 'C') t = {i, j};
if(c[i][j] == 'F') s = {i, j};
}
while(s != t){
ans++;
if(chk(s.first + dx[ls], s.second + dy[ls]))
s = {s.first + dx[ls], s.second + dy[ls]};
else ls = (ls + 1) % 4;
if(chk(t.first + dx[lt], t.second + dy[lt]))
t = {t.first + dx[lt], t.second + dy[lt]};
else lt = (lt + 1) % 4;
if(s == t){
printf("%d\n", ans);
return 0;
}
int tmp = s.first + s.second * 10 + t.first * 100 + t.second * 1000 + ls * 10000 + lt * 40000;
if(vis[tmp]){
printf("0");
return 0;
}
vis[tmp] = 1;
}
return 0;
}