My program is working for all tests ,BUT ACM don't like it...
Послано
gz 22 ноя 2006 10:44
If you will find any mistakes in my program please tell me about it..(Sorry for my bad English.)
Thank you.
program Kroft;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
n,m,x,y,x1,y1,i:byte;
a:array of array of char;
found:boolean=false;
count:integer;
procedure find;
var
ac:boolean;
i,j,k,l,f,d,index,index2,c:byte;
begin
c:=0;
ac:=false;
i:=0;
j:=m-1;
f:=n-1;
d:=0;
repeat
for k:=i to j do
begin
if ac and (a[i,k]<>'x') then inc(count);
if a[i,k]='x' then
if c=0 then
begin
inc(count);
inc(c);
a[i,k]:=#0;
ac:=true;
end
else
begin
found:=true;
exit;
end;
end;
dec(k);
inc(i);
for l:=i to f do
begin
if ac and (a[l,k]<>'x')then inc(count);
if a[l,k]='x' then
if c=0 then
begin
inc(count);
inc(c);
a[l,k]:=#0;
ac:=true;
end
else
begin
found:=true;
exit;
end;
end;
for index:=j-1 downto d do
begin
if ac and (a[f,index]<>'x')then inc(count);
if a[f,index]='x' then
if c=0 then
begin
a[f,index]:=#0;
inc(count);
ac:=true;
inc(c);
end
else
begin
found:=true;
exit;
end;
end;
for index2:=f-1 downto i do
begin
if ac and (a[index2,d]<>'x') then inc(count);
if a[index2,d]='x' then
if c=0 then
begin
inc(count);
a[index2,d]:=#0;
ac:=true;
inc(c);
end
else
begin
found:=true;
exit;
end;
end;
dec(j);
dec(f);
inc(d);
until found;
end;
begin
readln(n,m);
readln(x,y);
readln(x1,y1);
setlength(a,n);
x:=x-1;
y:=y-1;
x1:=x1-1;
y1:=y1-1;
for i:=0 to (n-1) do
setlength(a[i],m);
a[x,y]:='x';
a[x1,y1]:='x';
find;
write(count);
end.
Re: My program is working for all tests ,BUT ACM don't like it...
Give your mail, please, and I'll try to help you.
Edited by author 24.11.2006 19:44