BIO1 - Rooks
Aly being one of the smartest guys in his third grade class solved the question "How many ways to assign K cells for rooks in an N*M such that no two rooks are attacking each other" (A rook is a chess piece that can attack other pieces on the same row or the same column) but he was only able to solve it when N*M didn't exceed 10. After some days one of his classmates said he was able to solve it even if N*M reached 100. Aly kept asking how he did it and after questioning a lot of people he knew that he used a program to calculate this for him so he decided to challenge him in front of all his classmates but to do that he also needed a program that not only solve the problem when N*M reaches 100 but when N and M each reach 1,000,000 and he came for you to do that program for him but as he knows that the answer can be really big he wanted the program to output the number of ways modulo 1,000,000,007.
Input
The first and only line of input contains three numbers N, M and K (1 <= N, M <= 1,000,000, 1 <= K <= N*M).
Output
The number of ways required modulo 1,000,000,007.
Example
Input: 4 4 4 Output: 24
hide comments
nadstratosfer:
2019-01-27 19:15:06
Spam spam spam spam "How many ways to assign K cells for rooks in an N*M [board] such that no two rooks are attacking each other" spam spam spam spam spam spam modulo 1,000,000,007.
|
|
mahilewets:
2017-08-27 07:41:06
printf("0") doesn't prints anything
|
|
Akash Goel:
2014-12-04 14:28:46
I get WA at 37th test case. Any suggestions?
|
|
Rishav Goyal:
2014-03-03 22:54:38
anyone provide some testcases pls.
|
|
Rishav Goyal:
2014-03-03 22:34:01
WTF!! so many testcases ! need 5 minutes to check the correctness of solution every time we submiT! Last edit: 2014-03-03 22:34:16 |
|
Suprabh Shukla:
2011-06-13 07:18:52
my submission at ideone runs in .97s for 1000000 500000 ... still gives tle here at the 33rd case ... what to do ?
|
|
Aadit Prasad:
2011-03-20 22:33:37
WA at the 30th test case. Is there a trivial case easily missed?
|
|
anksanu:
2010-12-12 15:11:24
i used an optimize p&c equation for the problem still getting wrong answer.... |
|
Mitch Schwartz:
2010-10-05 13:23:48
Going along with smilitude's comment -- could you please clarify whether the answer should be given mod 10^6+7 or mod 10^9+7? |
|
Iqram Mahmud:
2010-10-05 13:23:48
You should fix the upper portion of the statement that says - "number of ways modulo 1,000,007".
|
Added by: | Omar ElAzazy |
Date: | 2010-10-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 BASH BF C CSHARP C++ 4.3.2 CPP CPP14 C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PERL6 PHP PIKE PRLG-swi PYTHON RUBY SCALA SCM guile SCM qobi ST SQLITE TCL WHITESPACE |
Resource: | own problem |