|
|
вернуться в форумPlease help me.I've WA#3.If you can,please,give me some tests.Thank!!!!Here is my code: Послано Search 20 авг 2008 02:54 #include<iostream.h> int main() { int n,i,j,k[7165],l,**a,b[7165],kol=0; cin>>n; a=new int *[n+1]; for(i=1;i<=n;i++) a[i]=new int[n+1]; for(i=1;i<=n;i++) for(j=1;j<=n;j++) a[i][j]=0; for(i=1;i<=n;i++) { cin>>k[i]; for(j=0;j<k[i];j++) { cin>>l; a[i][l]=1; } } for(i=1;i<=n;i++) { if(k[i]>1) { b[kol++]=i; for(j=i+1;j<=n;j++) if(a[j][i]==1) { a[j][i]=0; k[j]--; } } } cout<<kol<<endl; if(kol!=0){ for(i=0;i<kol;i++) cout<<b[i]<<" ";} return 0; } Thank in advance!!!!!! Re: Please help me.I've WA#3.If you can,please,give me some tests.Thank!!!!Here is my code: Try this: 4 1 3 2 3 4 3 1 2 4 2 2 3 Your output: 2 2 3 This answer is wrong. "If the groups are of the same size then you are to describe the group that contains the child number one" So possible answer is: 2 1 4 |
|
|