ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1287. Mars Canals

Why W. A. 4???? I cannot understand.++++++help please+++++++give me wrong test
Posted by Виктор Крупко 16 Jun 2005 00:17
program de;
    var
    a,b:array[-1400..1400] of integer;
    a1,b1:array[1..2800] of integer;
    i,j,n,max_a,max_b:integer;
    ch:char;
procedure diog;
begin
        if ch='s' then
            begin
             b[i-j]:=0;
             inc(a[i-j]);
             if a[i-j]>max_a then max_a:=a[i-j];
            end
         else
           begin
             a[i-j]:=0;
             inc(b[i-j]);
             if b[i-j]>max_b then max_b:=b[i-j];
            end;
end;
procedure diogobrat;
begin
        if ch='s' then
            begin
             b1[i+j]:=0;
             inc(a1[i+j]);
             if a1[i+j]>max_a then max_a:=a1[i+j];
            end
         else
           begin
             a1[i+j]:=0;
             inc(b1[i+j]);
             if b1[i+j]>max_b then max_b:=b1[i+j];
            end;
end;
procedure vivod;
begin
   if max_a=max_b then
      begin
        writeln('?');
        writeln(max_a);
      end
   else
   if max_a<max_b then
      begin
        writeln('S');
        writeln(max_b);
      end
   else
      begin
        writeln('s');
        writeln(max_a);
      end;
end;
begin
{   assign(input,'c:\test.txt');
   reset(input);                   }
   readln(n);
   for i:=1 to n do
   begin
     for j:=1 to n do
      begin
        read(ch);
        diog;
        diogobrat;
      end;
      readln;
   end;
   vivod;
end.
Re: Why W. A. 4???? I cannot understand.++++++help please+++++++give me wrong test
Posted by Ich 16 Jun 2005 23:38
There is test where your program wrongs:
5
sSSSS
SSsss
ssSSS
sSSss
sSSSS
Your program outputs
?
3
but real answer is obvious
S
4
Good luck!
Thanks, I have understood the mistake, and have solved her.+++++
Posted by Виктор Крупко 17 Jun 2005 00:36
I thought what to consider it is necessary only on a diagonal.
Thanks, now I have AC.
Re: Why W. A. 4???? I cannot understand.++++++help please+++++++give me wrong test
Thank you for this test and thanks to my friend Agabek.
I got AC now.
Re: Thanks, I have understood the mistake, and have solved her.+++++
Posted by Xkev 29 Oct 2022 07:56
Exactly! Do NOT forget to consider vertical and horizontal arrays.