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 Meeeeeee! What the hell's wrong?????????
Posted by Vladislav 1 Sep 2002 16:27
Can you correct my mistake please!!!!!!


var m               : Array[-10..20,-10..20] of 0..1;
    i,j,k,n,a,b     : INTEGER;
    Flag            : Boolean;
    e               : array[1..100] of record x,y : integer; end;
procedure work;
var z,l,index,beg,en : integer;
begin
index := 1; beg := 1; en := 1;
e[1].x:=a; e[1].y:=b;
m[a,b]:=0;
for j:=1 to n do
  begin
  for i:=beg to en do
     begin
     if m[e[i].x,e[i].y+1] = 1 then
        begin
        m[e[i].x,e[i].y+1] := 0;
        inc(index);
        e[index]:=e[i];
        inc(e[index].y);
        write('R');
        end;
     if m[e[i].x+1,e[i].y] = 1 then
        begin
        m[e[i].x+1,e[i].y] := 0;
        inc(index);
        e[index]:=e[i];
        inc(e[index].x);
        write('B');
        end;
     if m[e[i].x,e[i].y-1] = 1 then
        begin
        m[e[i].x,e[i].y-1] := 0;
        inc(index);
        e[index]:=e[i];
        dec(e[index].y);
        write('L');
        end;
     if m[e[i].x-1,e[i].y] = 1 then
        begin
        m[e[i].x-1,e[i].y] := 0;
        inc(index);
        e[index]:=e[i];
        dec(e[index].x);
        write('T');
        end;
     if i <> index then writeln(',') else writeln('.');
     end;
   beg := en + 1; en := index;
   end;
end;
begin
readln(n); for i:= 1 to n do begin readln(j,k); m[10-k+1,j]:=1; end;

{ Tursene na nai dolen lqv element }
Flag := False;
for i := 1 to 10 do
 if Flag then break else
  for j:= 10 downto 1 do
    if m[j,i] = 1 then begin Flag := True; a:=j; b:=i; Break end;
{ ... }

work;
end.