f:array[1..5,1..9,0..100]of longint;
a:array[1..5,1..9]of char;
begin
readln(n);for i:=1 to 5 do begin for j:=1 to 9 do
begin read(a[i,j]);if a[i,j]='L' then begin x:=i;y:=j;end;end;readln;end;
for i:=y downto 1 do begin if a[x,i]='K' then inc(e);f[x,i,e]:=y-i+1;end;
e:=0;for i:=y+1 to n do begin if a[x,i]='K' then inc(e);f[x,i,e]:=i-y+1;end;
for i:=x downto 2 do for j:=1 to 9 do
begin
e:=0;for k:=j downto 1 do begin if a[i-1,k]='K' then inc(e);
for l:=e to n do if ((f[i-1,k,l]=0)or(f[i-1,k,l]>f[i,j,l-e]+j-k+1))and(f[i,j,l-e]<>0) then
f[i-1,k,l]:=f[i,j,l-e]+j-k+1;end;
e:=0;for k:=j to 9 do begin if a[i-1,k]='K' then inc(e);
for l:=e to n do if ((f[i-1,k,l]=0)or(f[i-1,k,l]>f[i,j,l-e]+k-j+1))and(f[i,j,l-e]<>0) then
f[i-1,k,l]:=f[i,j,l-e]+k-j+1;end;
end;
for i:=1 to 5 do for j:=1 to 9 do for k:=max+1 to n do
if (f[i,j,k]>0)and(f[i,j,k]<=n+1) then max:=k;
writeln(max);
end.
状态: Unaccepted
测评机: Xeost[5]
得分: 70分
提交日期: 2010-9-28 12:29:00
有效耗时: 843毫秒
测试结果1: 通过本测试点|有效耗时219ms
测试结果2: 通过本测试点|有效耗时46ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 运行错误|普通保护错误
测试结果5: 运行错误|普通保护错误
测试结果6: 运行错误|普通保护错误
测试结果7: 通过本测试点|有效耗时47ms
测试结果8: 通过本测试点|有效耗时47ms
测试结果9: 运行错误|普通保护错误
测试结果10: 运行错误|普通保护错误
测试结果11: 通过本测试点|有效耗时47ms
测试结果12: 通过本测试点|有效耗时47ms
测试结果13: 通过本测试点|有效耗时47ms
测试结果14: 测试结果错误.错误结果为:4
正确结果应为:5
测试结果15: 通过本测试点|有效耗时46ms
测试结果16: 通过本测试点|有效耗时47ms
测试结果17: 通过本测试点|有效耗时63ms
测试结果18: 通过本测试点|有效耗时47ms
测试结果19: 通过本测试点|有效耗时47ms
测试结果20: 通过本测试点|有效耗时46ms