You are not logged in. Please login at to post your questions!


[ Closed ] Codeforces The World is a Theatre

Problem Statement : Click here.
I have approached at this formula for this question.
Assume C[n][r] = n!/(n-r)!*(r!)
ans = c[n][4] * c[m][1] * c[n+m-5][t-5]; <-- this is the formula i've got.
Please correct me, Where I've gone wrong?

asked 30 Jun '15, 18:29

vsukeeshbabu's gravatar image

accept rate: 0%

edited 30 Jun '15, 19:46

Your formula will lead to repeated cases. Example there are 4 boys and 3 girls and t = 6 then your answer is c[4][4] * c[3][1] * c[2][1] = 6 but answer is 3 because there are only 4 boys so each group needs to have all the boys plus 2 more girls for which there are C[3][2] ways = 3. What is happening is that once you fix certain girls/boys in the compulsory slot call them X and then you pick another set of boys/girls in the non compulsory slot, call them Y. Now it is possible that in some other group, you have already counted this group by including some of Y in the compulsory slots and some of X in the non compulsory slot.

Since t is small, I would suggest you go by the answer as -
ans = C[n][4] * C[m][t-4] + C[n][5] * C[m][t-5] + ..... C[n][t-1] * C[m][1]

Depending on n and m, there will be slight modifications in this, but you get the idea.


answered 30 Jun '15, 19:23

thezodiac1994's gravatar image

accept rate: 16%

edited 30 Jun '15, 19:42

Thanks! :)

(30 Jun '15, 19:47) vsukeeshbabu2★

No problem !

(30 Jun '15, 19:51) thezodiac19946★

I think c[n][4]*c[m][1] is enough.


answered 30 Jun '15, 19:13

pallesai's gravatar image

accept rate: 17%

please read the question carefully and check before answering here .

(30 Jun '15, 19:25) vsukeeshbabu2★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 30 Jun '15, 18:29

question was seen: 1,310 times

last updated: 30 Jun '15, 19:51