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 1008. Image Encoding

Help me, please I got WR
Posted by Algorithmus_UA(algorithmus@univ.kiev.ua) 6 Jun 2002 16:53
Help me, please I got WR, but all test that is in message board is
O.K!!!

-------------------THAT IS MYPROGRAM--------------------------------
type
PointType = record
             X,Y:byte;
            end;

var a:array[0..11,0..11]of byte;
    s1,s2:array[1..100]of pointtype;
    h1,h2,N,i,j,x,y:integer;
    bol:boolean;
procedure go(x,y:integer;ch:Char);
begin
  if a[x,y] = 1 then
  begin
    inc(h2);
    s2[h2].x:=x;s2[h2].y:=y;a[x,y]:=2;
    write(ch);
  end;
end;

begin
  read(n);
  for i:=1 to N do
  begin
    read(x,y);
    a[x,y]:=1;
  end;
  x:=11;y:=11;bol:=false;
  for i:=1 to 10 do
  begin
    for j:=1 to 10 do if (a[i,j] = 1) then
    begin
      x:=i;y:=j;bol:=true;break;
    end;
    if bol then break;
  end;
  writeln(x,' ',y);
  s1[1].x:=x;s1[1].y:=y;a[x,y]:=2;
  h1:=1;
  while true do
  begin
    h2:=0;
    for i:=1 to h1 do
    begin
      go(s1[i].x+1,s1[i].y,'R');
      go(s1[i].x,s1[i].y+1,'T');
      go(s1[i].x-1,s1[i].y,'L');
      go(s1[i].x,s1[i].y-1,'B');
      if (i=h1)and(h2=0)then write('.') else writeln(',');
    end;
    if h2 = 0 then break;
    for i:=1 to h2 do s1[i]:=s2[i];
    h1:=h2;
  end;
end.
You might be given ANY of two possible formats in the input (+)
Posted by shitty.Mishka 7 Jun 2002 13:29
This is an example of correct input:
1 1
.
The answer is
1
1 1

GL
Thank's
Posted by Algorithmus_UA(algorithmus@univ.kiev.ua) 7 Jun 2002 16:52