|
|
вернуться в форумWhy I got WA at test 3? Could you help me? var flag:boolean; total,n,i,j,l,k:integer; b:array [1..10000] of boolean; data,a:array [1..10000] of integer; begin read(n); k:=0; fillchar(data,sizeof(data),0); fillchar(b,sizeof(b),true); for i:=1 to n do begin read(l); total:=0; for j:=1 to l do begin read(a[j]); if b[a[j]] then inc(total); end; if total>1 then begin b[i]:=false; inc(k); data[k]:=i; end; end; if k<=n-k then begin writeln(k); for i:=1 to k do write(data[i],' '); end else begin writeln(n-k); for i:=1 to n do begin flag:=true; for j:=1 to k do if i=data[j] then flag:=false; if flag then write(i,' '); end; end; writeln; end. |
|
|