|
|
back to boardWhy WA? Please help me. Posted by Yang Yi 20 Sep 2002 16:18 var a:array[0..101]of set of 0..101; b:array[0..101]of integer; c:array[0..101]of byte; n,i,j,k:integer; begin fillchar(c,sizeof(c),0); readln(n); for i:=1to n do begin a[i]:=[];read(j);while j<>0do begin a[i]:=a[i]+[j];read(j)end end; i:=0; while i<n do begin for j:=n downto 1do if(c[j]=0)and(a[j]=[])then begin inc(i);b[i]:=j;c[j]:=1; for k:=1to n do a[k]:=a[k]-[j] end end; for i:=n downto 1do write(b[i],' ');writeln end. Re: Why WA? Please help me. Posted by Yang Yi 22 Sep 2002 09:40 > var > a:array[0..101]of set of 0..101; > b:array[0..101]of integer; > c:array[0..101]of byte; > n,i,j,k:integer; > begin > fillchar(c,sizeof(c),0); > readln(n); > for i:=1to n do > begin > a[i]:=[];read(j);while j<>0do begin a[i]:=a[i]+[j];read(j)end > end; > i:=0; > while i<n do > begin > for j:=n downto 1do > if(c[j]=0)and(a[j]=[])then > begin > inc(i);b[i]:=j;c[j]:=1; > for k:=1to n do > a[k]:=a[k]-[j] > end > end; > for i:=n downto 1do write(b[i],' ');writeln > end. Re: I've got AC. Posted by Yang Yi 22 Sep 2002 09:41 |
|
|