×

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".

19.8k350498541
accept rate: 36%

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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