过了样例 为什么10个wa(哇)

P1506 拯救oibh总部

可以从上下左右淹来,不能只b(0,0)
by bestzzy @ 2017-09-16 08:22:54


@[bestzzy](/space/show?uid=32854)
by 龙之吻—水货 @ 2017-09-19 20:27:08


我是先在周围添加一圈0 再进行搜索 所以相当于从四周淹过来吧?
by 龙之吻—水货 @ 2017-09-19 20:28:36


你应该只搜了左上,没搜右下,两边都得加,如果不是,我就不知道了; ~~我是P党~~,给下我的表 ```cpp var f:array[1..4,1..2]of longint; a:array[0..500,0..500]of longint; b:array[0..500,0..500]of boolean; i,j,n,m,ans:longint; x:ansistring; function check(x,y:longint):boolean; begin if (x>0)and(x<=n)and(y>0)and(y<=m)and(a[x,y]<>1)and(b[x,y]=true) then exit(true); exit(false); end; procedure dfs(x,y:longint); var i:longint; begin b[x,y]:=false; for i:=1 to 4 do if check(x+f[i,1],y+f[i,2]) then dfs(x+f[i,1],y+f[i,2]); exit; end; begin readln(n,m); f[1,1]:=0; f[1,2]:=1; f[2,1]:=1; f[2,2]:=0; f[3,1]:=0; f[3,2]:=-1; f[4,1]:=-1; f[4,2]:=0; for i:=1 to n do begin readln(x); for j:=1 to length(x) do if x[j]='*' then a[i,j]:=1; end; fillchar(b,sizeof(b),true); for i:=1 to m do begin if a[1,i]=0 then dfs(1,i); if a[n,i]=0 then dfs(n,i); end; for j:=1 to n do begin if a[j,1]=0 then dfs(j,1); if a[j,m]=0 then dfs(j,m); end; for i:=1 to n do for j:=1 to m do if (b[i,j])and(a[i,j]=0) then inc(ans); write(ans); end. ```
by bestzzy @ 2017-09-21 17:15:34


数组开大点
by bestzzy @ 2017-09-21 17:16:32


橙名大佬竟会被这种题绊倒
by 宸之辰 @ 2017-09-21 23:29:12


@[bestzzy](/space/show?uid=32854) 这个数组是够用的吧(我开大了依然wa) 而且看评测信息的时候都是我输入的比答案小
by 龙之吻—水货 @ 2017-09-26 19:20:50


@[bestzzy](/space/show?uid=32854) 当我发现n,m都被我设置成字符,并改过来AC后,发现自己真的是蒟蒻了
by 龙之吻—水货 @ 2017-11-09 12:45:05


@[龙之吻—水货](/space/show?uid=49866) 666
by bestzzy @ 2017-11-09 16:29:37


|