【正文】
end.。 writeln(max)。 work。 rewrite(output)。39。 reset(input)。39。end。 writeln。39。..39。var i,j:longint。end。 inc(l)。 deletestate(a[0,q[l].x,1q[l].f],q[l].y,q[l].x,1q[l].f,0)。 end。 if a[1,j,0][0,i].d=0 then addpoint(i,j,1)。 for i:=1 to n do for j:=1 to m do begin if a[0,i,0][0,j].d=0 then addpoint(i,j,1)。begin l:=1。procedure work。 end。 disposeline(a[mark,x,1flag],i,x,flag,mark)。begin i:=s[0,t].d。 t,x,flag,mark:longint)。end。 i:=s[t,i].r。 s[s[t,i].d,i].u:=s[t,i].u。begin i:=s[t,0].r。 t,x,flag,mark:longint)。end。 q[r].f:=flag。 q[r].x:=x。begin if f[x,y] then exit。end。 end。 end。 for j:=1 to c[0] do begin read(c[j])。 for i:=1 to m do begin t:=0。 end。 end。 for j:=1 to c[0] do begin read(c[j])。 for i:=1 to n do begin t:=0。begin readln(n,m)。procedure init。 end。 for i:=start to rest do begin b[now]:=i。 exit。 add0(a[flag,row,0])。 if (b[1]=4)and(b[2]=7)and(b[3]=9) then begin flag:=flag。begin if now=c[0]+1 then begin fillchar(t,sizeof(t),0)。procedure build(flag,row,now,start,rest:longint)。 end。 s[k,i].u:=s[maxstate,i].d。 l:=i。 for i:=1 to tt do if not t[i] then begin s[k,i].l:=l。 if kmax then max:=k。begin inc(s[0,0].d)。procedure add1(var s:state)。 end。 s[k,i].u:=s[maxstate,i].d。 l:=i。 for i:=1 to tt do if t[i] then begin s[k,i].l:=l。 if kmax then max:=k。begin inc(s[0,0].d)。procedure add0(var s:state)。 map:array[0..30,0..30]of longint。 n,m,tt:longint。 f:array[0..31,0..31]of boolean。 b,c:array[0..31]of longint。 state=array[0..maxstate,0..31]of node。 point=record x,y,f:longint。type node=record l,r,u,d:longint。 close(output)。 work。 rewrite(output)。39。 reset(input)。39。end。begin for i:=1 to n do b[i]:=a[i]。procedure work。 end。 for i:=k to nres+2 do