Dish DistributionProblem code: DISHDIS |
All submissions for this problem are available.
Chef feels that being the Head Chef is a very difficult job. More than cooking, managing the kitchen and distributing the work between various cooks proves to be a tiring task. There are many dishes to be prepared. And he has a team of talented cooks to do this for him. But the Chef always has a problem distributing tasks among them. For a cook i, the Chef wants to give him atleast xi dishes to prepare in a day. But different cooks have different capacities. Any cook i can cook atmost yi number of dishes in a single day. Chef is very aware of every cook's capability and will not give anyone more work than his maximum capacity. Now, he wants you to help him out here.
Your task will be simple: Tell him the number of ways in which he can distribute the given number of dishes among his team.
Input:
First line contains T, number of tests.
Each test begins with a single line containing 2 space separated integers: n and m, the number of dishes to be prepared and the number of cooks in Chef's team.
Then follow m lines. The ith line contains 2 space separater integers which are the corresponding xi and yi.
Output:
For every test case, output a single integer: the number of ways of distributing the work mod 1000000007.
Constraints:
1<=T<=501<=n,m<=100
0<=xi,yi<=100
Example:
Input1
3 2
0 3
1 3
Output
3
Explanation:
The chef can distribute the dishes in the following ways- 0 and 3 ; 1 and 2 ; 2 and 1 .
| Author: | vamsi_kavala |
| Date Added: | 2-08-2011 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

Whats happened if xi>yi,
Probably such a case will
It does not mean that input
Possibly yes but for the time
is it necessary to involve
it depends on xi.
can anybody give me the
How long you will remain
My DP gets TLED :(
can u pls giv me some more
admin pls provide a bigger
Hello. I'm almost sure that
what happened if n<(sum of
@admin should we assume xi
@admin , should we assume xi
@admin , is xi
is (xi
@admin ahould we assume xi
@admin my solution should
Can someone suggest why my
@friend please some one tell
@codersrikant : you are not
@admin Is it possible that
please someone tell me....is
Correct Answer Execution
@tanjea_stud : thanks for
hey...Anyone knows how 2 see
@prgcode955 if In between the
if xi is greater than yi ,
i have tried a number of
Recursive DP TLE!!! Iterative
do we also need to take care
The same code with C++ gcc
can any one explain this
could someone tell me whether
@admin Can you provide more
There is something weird with
plz tell me the answer for
skorknure, i had the same
@gn 13 for ur case the answer
@admin does xi need to be
@admin : could you please
@admin : could you please
I am also getting same
hi admin is it possible to
@mkagenius the time limit is
very strict time limit
@cool_tOad, chEcK tHAT uR
wow, solved first problem
" the number of ways of
The time limit exceeded when
Is it necessary that each
My n^3 iterative dp solution
what should be the answer
yes, i got it!
got it !!!! after long
Can anybody tell me what to
Got accepted with my DP n^3
Why i don't see the button
My problem was that i was
Can anyone tell me what was
Any one of the successful