只给我说为啥MLE就行了,WA的原因我找找
#include<bits/stdc++.h>
#define maxn 1000100
#define maxx 102
using namespace std;
typedef long long ll;
const ll dx[]={-1,1,0,0};
const ll dy[]={0,0,-1,1};
struct node{
ll x,y,step;
node(ll _x=0,ll _y=0,ll _step=0){
x=_x,y=_y,step=_step;
}
};
queue<node> q;
bool vis[maxx][maxx];
char a[maxx][maxx];
ll n,m,tp,ax,ay,bx,by,ans;
int main(){
scanf("%lld%lld%lld",&n,&m,&tp);
for(ll i=1;i<=n;i++){
for(ll j=1;j<=m;j++){
cin>>a[i][j];
}
}
scanf("%lld%lld%lld%lld",&ax,&ay,&bx,&by);
q.push((node){ax,ay,0});
while(!q.empty()){
node tmp=q.front();
q.pop();
if(tmp.step>tp) continue;
if(tmp.x==bx&&tmp.y==by&&tmp.step<=tp){
ans++;
continue;
}
for(ll i=0;i<4;i++){
ll xx=tmp.x+dx[i],yy=tmp.y+dy[i];
if(xx<1||xx>n||yy<1||yy>m) continue;
if(a[xx][yy]=='*') continue;
q.push((node){xx,yy,tmp.step+1});
}
}
printf("%lld",ans);
return 0;
}
蟹蟹qwq