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

×

BYTESHOP - Editorial

PROBLEM LINKS

Practice
Contest

DIFFICULTY

HARD

EXPLANATION

Inclusion Exclusion can be used to solve the problem. Let F(i,j) denote the number of ways in which atleast a given set of i people who do not purchase anything and
atleast a given set of j items which are not purchased by anyone.
F(i,j) = ncr[(n - i) * (m - j)][r] ;
There are ncr[n][i] ways to choose i people from n people, and ncr[m][j] ways to choose j items from m items. Let
G(i,j) = ncr[n][i] * ncr[m][j] * F(i,j)
The final answer is given by summing G(i,j) over all (i,j). We add G(i,j) to the answer if (i + j) is even, else we subtract it.

This question is marked "community wiki".

asked 28 Nov '12, 19:40

admin's gravatar image

0★admin ♦♦
19.8k350498541
accept rate: 36%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×15,683
×1,343
×7
×1

question asked: 28 Nov '12, 19:40

question was seen: 1,483 times

last updated: 28 Nov '12, 19:40