Page 1 of 1

11668 - How Many Teams

Posted: Tue Sep 15, 2009 10:43 pm
by rushel
can anybody please give some test cases of the following problem:

http://uva.onlinejudge.org/index.php?op ... oblem=2715

Re: 11668

Posted: Wed Sep 16, 2009 8:44 am
by rushel
Thanks got AC

Re: 11668 - How Many Teams

Posted: Thu Sep 17, 2009 2:37 am
by tryit1
Can you give some hints, I thought of maximum matching but it is too complicated

Re: 11668

Posted: Thu Sep 17, 2009 9:46 am
by ardiankp
Hint please.. I've tried DP of configurations, but always get TLE.

Re: 11668

Posted: Fri Sep 18, 2009 8:56 pm
by rushel
let, a = number of departments which has 1 student, b = number of departments which has 2 students and c=number of departments which has 3 students.

Now let dp[a][c]=number of permutations
we know 1*a+2*b+3*c=N and N%K==0 so we have to make N/K groups
Suppose now we want to form a group, we can choose c1 students from departments which have 1 students, c2 students from departments which have 2 students and c3 students from departments which have 3 students such that c1+c2+c3=K.

Re: 11668

Posted: Sat Sep 19, 2009 9:22 am
by Khongor_SMCS
Thanks your hint rushel.
I missed this part
Due to the limited number of seats, a department can send at most 3 members.

Re: 11668

Posted: Sat Sep 19, 2009 9:47 am
by tryit1
if we do as above, don't we need to track which department has allocated student to which partition.

f(a,b,c) = f(a-x,b,c)*Bin(a,x) *Bin(b,y)*Bin(c,z) *( k!). (x+y+z=k)

Re: 11668

Posted: Sat Sep 19, 2009 6:58 pm
by ardiankp
I missed that part also. Thanks!