RT,我在考场本地测的所有样例都没啥问题,时间复杂度也算了没啥问题,但是在luogu交显示编译错误,大佬们能否看一下啥问题,谢谢
#include<bits/stdc++.h>
//#define int long long
using namespace std;
int t,n,m,k,x,y,d,x1,y1,ans;
int a[1200][1200],vis[1200][1200];
char c[20000];
signed main(){
// freopen("explore.in","r",stdin);
// freopen("explore.out","w",stdout);
cin>>t;
while(t--){
cin>>n>>m>>k>>x>>y>>d;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
a[i][j] = vis[i][j] = 0;
for(int i=1;i<=n;i++){
cin>>c;
for(int j=0;j<=m;j++)
a[i][j+1] = (c[j]=='x')?1:0;
}
vis[x][y] = 1;
for(int i=1;i<=k;i++){
x1 = x; y1 = y;
if(d==0) y1++;
if(d==1) x1++;
if(d==2) y1--;
if(d==3) x1--;
if(x1<1||x1>n||y1<1||y1>m||a[x1][y1]==1){
d++;
}
else{
x = x1;
y = y1;
}
d %= 4;
vis[x][y] = 1;
}
ans = 0;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
if(vis[i][j]) ans++;
cout<<ans<<endl;
}
return 0;
}