## 11668 - How Many Teams

Moderator: Board moderators

rushel
Learning poster
Posts: 67
Joined: Sat Jan 22, 2005 5:57 am

### 11668 - How Many Teams

can anybody please give some test cases of the following problem:

http://uva.onlinejudge.org/index.php?op ... oblem=2715
rushel
Learning poster
Posts: 67
Joined: Sat Jan 22, 2005 5:57 am

### Re: 11668

Thanks got AC
tryit1
Experienced poster
Posts: 119
Joined: Sun Aug 24, 2008 9:09 pm

### Re: 11668 - How Many Teams

Can you give some hints, I thought of maximum matching but it is too complicated
ardiankp
New poster
Posts: 27
Joined: Mon Nov 01, 2004 4:04 pm

### Re: 11668

Hint please.. I've tried DP of configurations, but always get TLE.
rushel
Learning poster
Posts: 67
Joined: Sat Jan 22, 2005 5:57 am

### Re: 11668

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.
Khongor_SMCS
New poster
Posts: 15
Joined: Thu Jun 18, 2009 12:01 pm
Contact:

### Re: 11668

I missed this part
Due to the limited number of seats, a department can send at most 3 members.
tryit1
Experienced poster
Posts: 119
Joined: Sun Aug 24, 2008 9:09 pm

### Re: 11668

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)
ardiankp
New poster
Posts: 27
Joined: Mon Nov 01, 2004 4:04 pm

### Re: 11668

I missed that part also. Thanks!