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 1313. Some Words about Sport

why wa??
Posted by Koryakov Anton_ghost_Anigus 1 Jan 2006 18:43
program sport_question_1313_sub;

{$APPTYPE CONSOLE}
const maxx=100;
exid=111;
var max,cou,cou2,cou3,x,y,n,sx,sy:integer;
arr:array[0..maxx+1,0..maxx+1] of integer;
oup:array[1..10000] of integer;
ch,ex,met:boolean;
str,str2:string;
le:integer;
err,num:integer;
begin
readln(max);
str2:='';
for cou:=0 to maxx+1 do
for cou2:=0 to maxx+1 do
arr[cou,cou2]:=exid;           {filling with ex parameter(111)}

for cou:=1 to max do
begin
  readln(str);
  le:=length(str);
  cou2:=0;
  for cou3:=1 to le do
  begin
    str2:=concat(str2,str[cou3]);
    if (str2[length(str2)]=' ') and (length(str2)<>1)  then
    begin
      inc(cou2);
      val(str2,num,err);
      str2:='';
      arr[cou,cou2]:=num;
    end;
    if (str2=' ')  then str2:='';
  end;
  if (str2<>' ')  then
  begin
  inc(cou2);
      val(str2,num,err);
      str2:='';
      arr[cou,cou2]:=num;
      end;
  str2:='';
end;  {parcing}

{while met=false do
begin}
x:=1;
y:=1;
sx:=1;
sy:=1;
{cou:=1; }
cou3:=0;
while ex=false do
begin
n:=arr[x,y];
if n=exid then
begin
sx:=sx+1;
ch:=true;
if arr[sx,sy]=exid then
begin
sx:=sx-1;
sy:=sy+1;
if arr[sx,sy]=exid then ex:=true;
end;
end;
{if ex=true then break; }
if ch=true then
begin
x:=sx;
y:=sy;
ch:=false;
end else
begin
if arr[x,y]<>exid then begin
cou3:=cou3+1;
oup[cou3]:=n;
 x:=x-1;
 y:=y+1;
end;

end;
end;
{end; }


for cou2:=1 to cou3-1 do
write(oup[cou2],' ');
writeln(oup[cou3]);
{readln;  }

end.

Edited by author 01.01.2006 18:44
You've got AC. Nice to see you resuming problemsolving at last (-)
Posted by Dmitry 'Diman_YES' Kovalioff 1 Jan 2006 20:11