floodfill @ 2024-10-27 14:13:38
考场上
by sdjjdjdjdjd @ 2024-10-27 14:18:51
看ccf的数据了,我只知道模拟t2肯定能满
by _yAy_ @ 2024-10-27 14:21:16
@sdjjdjdjdjd CCF数据公开吗?
by floodfill @ 2024-10-27 14:23:37
@sdjjdjdjdjd 用大样例测过了,全是空地会wa
by sdjjdjdjdjd @ 2024-10-27 14:49:33
@yAy 应该不公开,但给的样例luogu上就有
by sdjjdjdjdjd @ 2024-10-27 14:50:34
@yAy 我指的是看ccf的数据出的怎么样,不是我真知道,可能你误解了?
by sdjjdjdjdjd @ 2024-10-27 14:54:44
@floodfill 给你贴个代码
#include<iostream>
using namespace std;
int main(){
//freopen("explore.in","r",stdin);
//freopen("explore.out","w",stdout);
int T;
for(scanf("%d",&T);T;T--){
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
int x,y,d;
scanf("%d%d%d",&x,&y,&d);
const int xd[4]={0,1,0,-1};
const int yd[4]={1,0,-1,0};
char a[n+3][m+3]={0};
bool vis[n+3][m+3]={0};
for(int i=1;i<=n;i++) scanf("%s",a[i]+1);
long long ans=1;
vis[x][y]=1;
while(k--){
if(x+xd[d]>n||x+xd[d]<1||y+yd[d]>m||y+yd[d]<1||a[x+xd[d]][y+yd[d]]!='.'){
d=(d+1)%4;
continue;
}
x+=xd[d],y+=yd[d];
if(!vis[x][y]) ans++;
vis[x][y]=1;
}
printf("%lld\n",ans);
}
return 0;
}