Is There a Fast Way to Compute This Combinatoric Quantity?

Revision en2, by amr0, 2019-09-21 20:06:02

Hello Codeforcians!

I would like to know if there is an efficient method to calculate

$$$ \sum_{k_A+k_B+k_O+k_R=k}{N\choose A+k_A,B+k_B,O+k_O,R+k_R} $$$

where $$$k = N-(A+B+O+R)$$$ (of course all k's are greater than or equal zero), the output is modulo $$$1'000'000'007$$$, and $$$0\leq A,B,O,R, N\leq 400,000$$$. The time limit was 2 seconds, however any suggestions are more than welcome.

Thank you!

Tags #combinatorics

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English amr0 2019-09-21 20:09:33 0 (published)
en2 English amr0 2019-09-21 20:06:02 9 Tiny change: 'ater than zero), th' -> 'ater than or equal zero), th' (saved to drafts)
en1 English amr0 2019-09-21 20:05:29 449 Initial revision (published)