Chef And Colors
All submissions for this problem are available.
Chef and his brother Bakku has N balls each. It is also known that both of them also have equal number of distinct colored balls. There are 2 special balls, out of which any one is randomly given to Chef and other is given to Bakku.
Help Chef to find number of ways to color all 2*N+2 balls with K colors before distributing special balls so that both of them have equal number of distinct balls for any distribution of special balls.
Note: For any distribution of Special balls both must have equal number of distinct colored balls.
1 <= N <= 1000
1 <= K <= 1000000
A Single line containing of 2 integers N and K.
Print the number of ways of coloring so that given constraint is satisfied modulo 1000000007.
|Tags||dynamic-programming, ipc15flb, medium, skullcrackers|
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions