Nikitosh and Sauron-tetrahedron
All submissions for this problem are available.
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
A dark tetrahedron's size is said to be N if each of its edges consists of N segments.
To destroy a dark tetrahedron of size N, you have to erase at least N segments (you can't destroy a dark tetrahedron partially: the tetrahedron uses dark magic to self-cure if you erase less than N segments, and so it's the same as not erasing any segment). Also, to protect yourself from the tetraheldral curse, you must ensure that each vertex of a tetrahedron needs to have at least 2 incident segments. Note that a dark tetrahedron has 4 vertices, just like regular tetrahedrons.
A Sauron-tetrahedron of size N with resistance K is made of N dark tetrahedrons with sizes 1, 2, ... , N. To destroy a Sauron-tetrahedron, you have to destroy at least K of its constituent tetrahedrons.
Wizard Nikitosh needs to detroy a Sauron-tetahedron of size N with resistance K and he wants to know how many ways to destroy it are there. Since Nikitosh's creative juices only flow for wizardry, he needs your mathematical talent to solve this problem.
You also need to follow the wizard's order to output the answer modulo 105+3.
The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows.
For each test case, a single line contains two integers, N and K, representing the size of the super tetrahedron and its resistance.
For each test case, output a single line. It must contain the number of ways to destroy a super tetrahedron of size N with resistance K (modulo 105+3).
- 1 ≤ T ≤ 5
- 1 ≤ N ≤ 6*104
- 1 ≤ K ≤ N
- Subtask #1 (20 points): 1 ≤ N ≤ 103
- Subtask #2 (80 points): 1 ≤ N ≤ 6*104
Input: 2 1 1 2 1 Output: 9 2439
|Tags||binomial, fourier, karatsuba, medium-hard, nov15, rebryk|
|Time Limit:||3 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