Who can help me?
I don't understand why my grogram got "WA",please help me.
Thank you!
Here is my grogram:
const
inp='';
maxn=100;
var
a:array[1..18,1..3]of 0..51;
t:set of 1..51;
n,max,ma:integer;
procedure input;
var
b:array[1..maxn] of string[20];
i,j,k,m:integer;
s:string;
f:text;
begin
fillchar(a,sizeof(a),0);
assign(f,inp);
reset(f);
readln(f,n);
fillchar(b,sizeof(b),' ');
m:=0;
for i:=1 to n do
begin
readln(f,s);
k:=pos(' ',s);
for j:=1 to m do
if copy(s,1,k-1)=b[j] then begin a[i,1]:=j;break;end;
if a[i,1]=0 then begin m:=m+1;a[i,1]:=m;b[m]:=copy(s,1,k-1);end;
delete(s,1,k);
k:=pos(' ',s);
for j:=1 to m-1 do
if copy(s,1,k-1)=b[j] then begin a[i,2]:=j;break;end;
if a[i,2]=0 then begin m:=m+1;a[i,2]:=m;b[m]:=copy(s,1,k-1);end;
delete(s,1,k);
for j:=1 to m-1 do
if s=b[j] then begin a[i,3]:=j;break;end;
if a[i,3]=0 then begin m:=m+1;a[i,3]:=m;b[m]:=s;end;
end;
close(f);
end;
procedure find(i:integer);
var
j:integer;
begin
for j:=1 to 2 do
if not(a[i,1] in t)and not(a[i,2] in t)and not(a[i,3] in t) then
begin
t:=t+[a[i,1]]+[a[i,2]]+[a[i,3]];
ma:=ma+1;
if i<>n then find(i+1) else if ma>max then max:=ma;
ma:=ma-1;
t:=t-[a[i,1]]-[a[i,2]]-[a[i,3]];
end else if i<>n then find(i+1) else if ma>max then max:=ma;
end;
begin
input;
max:=0;ma:=0;
find(1);
writeln(max);
end.