Statistics

Problem Statement for "AlienAndSetDiv1"

Problem Statement

Alien Fred wants to destroy the Earth. But before he does that, he wants to solve the following problem.

He has the set {1, 2, 3, ..., 2N}. He wants to split this set into two new sets A and B. The following conditions must all be satisfied:

  • Each element of the original set must belong to exactly one of the sets A and B.
  • The two new sets must have the same size. (I.e., each of them must contain exactly N numbers.)
  • For each i from 1 to N, inclusive: Let A[i] be the i-th smallest element of A, and let B[i] be the i-th smallest element of B. The difference |A[i] - B[i]| must be greater than or equal to K.

You are given the two ints N and K. Let X be the total number of ways in which Fred can choose the sets A and B. Return the value (X modulo 1,000,000,007).

Definition

Class:
AlienAndSetDiv1
Method:
getNumber
Parameters:
int, int
Returns:
int
Method signature:
int getNumber(int N, int K)
(be sure your method is public)

Constraints

  • N will be between 1 and 50, inclusive.
  • K will be between 1 and 10, inclusive.

Examples

  1. 2

    2

    Returns: 2

    The initial set is {1, 2, 3, 4}. The following 6 pairs of subsets are possible in this case: A={1, 2} and B={3, 4} A={1, 3} and B={2, 4} A={1, 4} and B={2, 3} A={2, 3} and B={1, 4} A={2, 4} and B={1, 3} A={3, 4} and B={1, 2} The first option and the last option are both valid. The other 4 options are invalid. Note that order of the two sets matters: the option A={1,2} and B={3,4} differs from the option A={3,4} and B={1,2}.

  2. 3

    1

    Returns: 20

  3. 4

    2

    Returns: 14

  4. 10

    7

    Returns: 40

  5. 10

    1

    Returns: 184756

  6. 10

    2

    Returns: 21900

  7. 10

    3

    Returns: 5854

  8. 10

    4

    Returns: 1750

  9. 10

    5

    Returns: 506

  10. 10

    6

    Returns: 140

  11. 10

    7

    Returns: 40

  12. 10

    8

    Returns: 12

  13. 10

    9

    Returns: 4

  14. 50

    10

    Returns: 660636822

  15. 50

    9

    Returns: 571267552

  16. 50

    8

    Returns: 895535537

  17. 50

    7

    Returns: 676776543

  18. 50

    6

    Returns: 521968290

  19. 50

    5

    Returns: 837255429

  20. 50

    4

    Returns: 793289036

  21. 50

    3

    Returns: 572592210

  22. 50

    2

    Returns: 796418490

  23. 50

    1

    Returns: 538992043

  24. 47

    7

    Returns: 748246841

  25. 44

    3

    Returns: 844194711

  26. 49

    8

    Returns: 5306033

  27. 17

    10

    Returns: 6864

  28. 17

    5

    Returns: 4447010

  29. 25

    5

    Returns: 882255210

  30. 36

    6

    Returns: 58766979

  31. 44

    9

    Returns: 533992820

  32. 18

    8

    Returns: 366470

  33. 35

    3

    Returns: 207139387

  34. 37

    8

    Returns: 815165631

  35. 27

    9

    Returns: 949750756

  36. 16

    1

    Returns: 601080390

  37. 16

    8

    Returns: 25742

  38. 38

    4

    Returns: 889606526

  39. 33

    10

    Returns: 556842004

  40. 32

    7

    Returns: 451903069

  41. 30

    1

    Returns: 737009364

  42. 29

    2

    Returns: 100582306

  43. 47

    3

    Returns: 714086996

  44. 39

    9

    Returns: 797990623

  45. 41

    4

    Returns: 802755245

  46. 43

    1

    Returns: 203144612

  47. 46

    3

    Returns: 320978089

  48. 47

    9

    Returns: 958559167

  49. 49

    9

    Returns: 707328735

  50. 28

    10

    Returns: 456330055

  51. 5

    2

    Returns: 44

  52. 48

    7

    Returns: 217835061

  53. 35

    9

    Returns: 618180916


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: