Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
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. Either use some imagination or simply pose the damn question. Please! |
|
2017-08-27 07:41:06
printf("0") doesn't prints anything printf("0\n") prints "0" |
|
2014-12-04 14:28:46 Akash Goel
I get WA at 37th test case. Any suggestions? Also, how many total test cases are there? It takes a helluva lot time to run this code. Last edit: 2014-12-05 07:10:37 |
|
2014-03-03 22:54:38 Rishav Goyal
anyone provide some testcases pls. Finally AC!! Last edit: 2014-03-03 23:22:39 |
|
2014-03-03 22:34:01 Rishav Goyal
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 |
|
2011-06-13 07:18:52 Suprabh Shukla
my submission at ideone runs in .97s for 1000000 500000 ... still gives tle here at the 33rd case ... what to do ? EDIT : Maybe just wasn't good enough. Last edit: 2011-06-13 10:05:09 |
|
2011-03-20 22:33:37 Aadit Prasad
WA at the 30th test case. Is there a trivial case easily missed? EDIT: Never mind. Last edit: 2011-03-23 19:00:44 |
|
2010-12-12 15:11:24 anksanu
i used an optimize p&c equation for the problem still getting wrong answer.... |
|
2010-10-05 13:23:48 Mitch Schwartz
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? |
|
2010-10-05 13:23:48 Iqram Mahmud
You should fix the upper portion of the statement that says - "number of ways modulo 1,000,007". Omar ElAzazy: Fixed. It should be 1e9 + 7. Last edit: 2010-10-05 13:19:28 |