Help Wa#11
program Ural1287;
var
map:array[0..1401,0..1401]of boolean;
ans,i,j,n,k:longint;
c:char;
function max(a,b:longint):longint;
begin
if a>b then exit(a) else exit(b);
end;
procedure dm(i,j:longint);
begin
if ans=k then if map[i,j]xor(c='S') then c:='?';
if ans<k then
begin
ans:=k;
if map[i,j] then c:='S'
else c:='s';
end;
k:=1;
end;
begin
readln(n);
for i:=1 to n do
begin
for j:=1 to n do
begin
read(c);
map[i,j]:=c='S';
end;
readln;
end;
c:=' ';
for i:=1 to n do
begin
k:=1;
for j:=2 to n do
begin
if map[i,j]=map[i,j-1] then inc(k)
else dm(i,j-1);
end;
dm(i,n);
end;
for i:=1 to n do
begin
k:=1;
for j:=2 to n do
begin
if map[j,i]=map[j-1,i] then inc(k)
else dm(j-1,i);
end;
dm(n,i);
end;
for i:=1 to n do
begin
k:=1;
for j:=i+1 to n do
begin
if map[j-i+1,j]=map[j-i,j-1] then inc(k)
else dm(j-i,j-1);
end;
dm(j-i+1,n);
k:=1;
for j:=i+1 to n do
begin
if map[j,j-i+1]=map[j-i,j-1] then inc(k)
else dm(j-1,j-i);
end;
dm(n,j-i+1);
end;
for i:=1 to n do
begin
k:=1;
for j:=2 to i do
begin
if map[i-j+1,j]=map[i-j+2,j-1] then inc(k)
else dm(i-j+2,j-1);
end;
dm(i,1);
k:=1;
for j:=2 to i do
begin
if map[j,i-j+1]=map[j-1,i-j+2] then inc(k)
else dm(j-1,i-j+2);
end;
dm(1,i);
end;
writeln(c);
writeln(ans);
end.
Wa#11 Who can help me???