Statistics

Problem Statement for "CommitteeContinuity"

Problem Statement

Time limit: 5 seconds.


A country club has M members. They are numbered from 0 to M-1.

The club has existed for Y years. The years are numbered from 0 to Y-1. All M members were in the club during its entire existence.


At the start of each year the club elected a steering committee for that year from among its members. There were no restrictions on the size of the committee, so it's possible that in different years the committee had a different number of members. It's even possible that for some years everyone was on the steering committee.

There was only one rule that was dilligently followed during the club's existence: due to continuity, the new committee and the old committee from previous year may never be disjoint. There must always be at least one person who stays on the committee (to take care of projects that are still ongoing).


Most of the information about the past steering committes has been lost when the club's library burned down. We only remember some (potentially incomplete) information about a very small number of members.

This information is given in the int[]s year and member. For each valid index i we are told that person number member[i] was a member of the steering committee during the year year[i].


A valid history is a sequence of Y steering committees that is consistent with the continuity rule and all the remembered information.

Count all valid histories. Return that count modulo 10^9 + 7.

Definition

Class:
CommitteeContinuity
Method:
count
Parameters:
int, int, int[], int[]
Returns:
int
Method signature:
int count(int M, int Y, int[] year, int[] member)
(be sure your method is public)

Constraints

  • M will be between 1 and 50, inclusive.
  • Y will be between 1 and 50, inclusive.
  • year will have between 0 and 50 elements, inclusive.
  • Each element of year will be between 0 and Y-1, inclusive.
  • member will have the same number of elements as year.
  • Each element of member will be between 0 and M-1, inclusive.
  • All pairs (year[i], member[i]) will be mutually distinct.
  • member will contain at most 10 distinct values.

Examples

  1. 3

    5

    {0, 1, 2, 3, 4}

    {0, 0, 0, 0, 0}

    Returns: 1024

    We are told that member #0 was on the committee during all five years. As this takes care of continuity, there are no other constraints on the committee's composition. Thus, during each of the five years the committee had four options: it was {0}, {0, 1}, {0, 2}, or {0, 1, 2}. As these choices are mutually independent, there are 4^5 = 1024 valid histories.

  2. 2

    3

    {}

    {}

    Returns: 17

    Two members, three years. All 17 valid histories are listed below: {0}, {0}, {0} {0}, {0}, {0, 1} {0}, {0, 1}, {0} {0}, {0, 1}, {0, 1} {0}, {0, 1}, {1} {0, 1}, {0}, {0} {0, 1}, {0}, {0, 1} {0, 1}, {0, 1}, {0} {0, 1}, {0, 1}, {0, 1} {0, 1}, {0, 1}, {1} {0, 1}, {1}, {0, 1} {0, 1}, {1}, {1} {1}, {0, 1}, {0} {1}, {0, 1}, {0, 1} {1}, {0, 1}, {1} {1}, {1}, {0, 1} {1}, {1}, {1}

  3. 2

    3

    {1, 1}

    {0, 1}

    Returns: 9

    Again, two people and three years. This time we are told that during year 1 the steering committee contained both 0 and 1, which means that it must have been {0, 1}. Each valid history now has the following form: (any non-empty committee), {0, 1}, (any non-empty committee). Thus, there are 3*3 = 9 valid histories.

  4. 40

    1

    {}

    {}

    Returns: 511620082

    Obviously, this return value is (2^40 - 1) modulo (10^9 + 7).

  5. 4

    5

    {1, 2}

    {1, 2}

    Returns: 111156

  6. 50

    50

    {3, 3, 4, 6, 6, 6, 27, 38, 38, 49}

    {0, 1, 2, 5, 6, 7, 9, 11, 13, 17}

    Returns: 452907325

  7. 50

    50

    {}

    {}

    Returns: 50368517

  8. 50

    50

    {1, 1, 7, 6, 5, 4, 4, 12, 15, 18, 4, 22, 23, 24, 39, 39, 4, 31, 31, 32, 32, 33, 33, 34}

    {2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16 }

    Returns: 822474926

  9. 50

    50

    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

    {0, 1, 2, 5, 6, 7, 9, 11, 13, 14}

    Returns: 529285768

  10. 1

    1

    {}

    {}

    Returns: 1

  11. 1

    1

    {0}

    {0}

    Returns: 1

  12. 1

    50

    {}

    {}

    Returns: 1

  13. 1

    50

    {3, 1, 4, 9, 47, 23}

    {0, 0, 0, 0, 0, 0}

    Returns: 1

  14. 2

    4

    {0, 0, 1, 1, 2, 2, 3, 3}

    {0, 1, 0, 1, 0, 1, 1, 0}

    Returns: 1

  15. 2

    7

    {0, 1, 2, 3, 4, 5, 6}

    {0, 1, 0, 1, 0, 1, 0}

    Returns: 34

  16. 31

    22

    {3, 3, 19, 11, 17, 0, 13, 7, 21, 17, 19, 10, 11, 10, 1, 13, 1, 10, 15, 16, 12, 14, 0, 7, 18}

    {10, 16, 18, 8, 18, 17, 14, 16, 18, 17, 17, 8, 16, 14, 8, 16, 14, 17, 16, 18, 8, 14, 18, 8, 14}

    Returns: 246713238

  17. 44

    45

    {25, 16, 25, 16, 36, 19, 36}

    {35, 16, 22, 22, 16, 35, 35}

    Returns: 989412595

  18. 31

    33

    {}

    {}

    Returns: 993431880

  19. 40

    23

    {22, 22, 21, 14, 14, 14, 22, 16, 15, 16, 6, 16, 15, 22, 6, 15, 22, 6, 22, 15, 6, 15, 6, 21, 15, 6, 21, 14, 21, 14, 14, 16, 16, 21, 21, 16}

    {2, 8, 16, 4, 1, 16, 23, 4, 2, 1, 2, 16, 8, 1, 8, 23, 4, 23, 16, 4, 1, 1, 4, 2, 16, 16, 8, 2, 23, 8, 23, 2, 8, 4, 1, 23}

    Returns: 685645026

  20. 41

    25

    {8, 0, 21, 21, 0, 21, 11, 0, 8, 19, 8, 6, 6}

    {4, 4, 19, 3, 19, 38, 38, 38, 19, 19, 3, 19, 38}

    Returns: 13055815

  21. 29

    20

    {19, 6}

    {19, 19}

    Returns: 69431596

  22. 20

    23

    {}

    {}

    Returns: 578112965

  23. 21

    37

    {4, 19}

    {2, 1}

    Returns: 518299848

  24. 39

    34

    {30, 18, 7, 27, 11, 31, 27, 8, 9, 1, 31, 2, 24, 26, 12, 0, 8, 8, 1, 7, 14, 9, 15, 29}

    {6, 38, 38, 16, 5, 38, 38, 21, 26, 21, 16, 38, 38, 38, 21, 16, 26, 38, 26, 21, 26, 21, 6, 5}

    Returns: 100551995

  25. 39

    29

    {1, 8, 21, 1, 3, 11, 3, 10, 8, 12, 10, 14, 20, 11, 25, 24, 9, 15, 0, 19, 18}

    {31, 0, 34, 0, 31, 11, 34, 27, 11, 27, 11, 27, 0, 31, 27, 31, 0, 34, 0, 28, 11}

    Returns: 312607854

  26. 41

    23

    {9, 20, 11, 22, 15, 2, 6, 9, 11, 0, 13, 2, 18, 15, 6, 17, 6, 19, 8, 18, 1, 17, 17, 8, 19, 10, 21, 10, 5, 1, 3, 14, 21, 21, 12, 3, 5, 16, 5, 7, 7, 7}

    {39, 14, 39, 14, 39, 39, 39, 11, 14, 14, 11, 11, 14, 11, 11, 39, 14, 39, 39, 11, 39, 11, 14, 11, 14, 11, 39, 14, 39, 14, 39, 39, 14, 11, 14, 11, 11, 39, 14, 39, 11, 14}

    Returns: 100215767

  27. 40

    40

    {20, 29, 24, 11, 13, 13, 15, 4, 15, 32, 37, 19, 30, 3, 21, 23, 14, 5, 27, 18}

    {5, 26, 5, 35, 26, 35, 26, 5, 35, 5, 35, 26, 35, 5, 26, 35, 26, 26, 26, 5}

    Returns: 15014084

  28. 20

    42

    {40, 21, 20, 17, 28, 33, 11, 13, 39, 15, 40, 29, 23, 23, 5, 0, 10, 35, 2, 13, 18, 1, 39, 34, 4, 4, 28, 19, 11, 25, 15, 26}

    {14, 10, 14, 15, 15, 8, 17, 14, 8, 14, 10, 16, 9, 6, 9, 10, 14, 16, 13, 13, 9, 17, 13, 14, 10, 16, 10, 16, 6, 14, 9, 15}

    Returns: 514115769

  29. 37

    35

    {11, 33, 15, 12, 15, 14, 17, 17, 8, 32, 28, 6, 15, 12, 5, 27, 3, 8, 28, 1, 16, 16, 20, 3, 14, 9, 0, 11, 33, 13, 2, 11}

    {36, 36, 27, 10, 33, 10, 12, 21, 15, 15, 36, 20, 20, 21, 15, 15, 27, 17, 20, 20, 12, 21, 27, 17, 20, 15, 12, 15, 15, 12, 12, 27}

    Returns: 974036383

  30. 30

    39

    {27, 19, 24, 18, 4, 30, 11, 3, 15, 2, 29, 36, 2, 38}

    {9, 8, 8, 23, 29, 23, 29, 23, 23, 29, 9, 29, 2, 8}

    Returns: 830162701

  31. 48

    50

    {49, 34, 3, 34, 21, 47, 25, 15, 48, 16, 6, 16, 16, 14, 19, 0, 22, 33, 39, 23, 45, 47, 1, 10, 43, 43, 8}

    {20, 7, 7, 16, 25, 25, 16, 11, 11, 16, 20, 25, 34, 21, 11, 16, 34, 16, 16, 11, 11, 20, 7, 16, 25, 34, 34}

    Returns: 547959982

  32. 48

    49

    {29, 18, 5, 29, 9, 5, 11, 33, 48, 18, 29, 33, 9, 29, 5, 11, 18, 5, 48, 5, 9, 11, 33, 29, 9, 18, 29, 11, 18, 33, 18, 29, 48, 48, 9, 5, 9, 11, 33, 11, 33, 11, 33, 9, 48, 48, 5, 48, 18}

    {14, 44, 16, 44, 14, 25, 14, 14, 14, 16, 16, 44, 44, 25, 6, 44, 25, 9, 44, 18, 16, 16, 16, 6, 25, 9, 9, 25, 6, 25, 18, 18, 25, 16, 9, 14, 6, 9, 9, 6, 6, 18, 18, 18, 6, 9, 44, 18, 14}

    Returns: 682223062

  33. 49

    48

    {13, 24, 38, 39, 26, 0, 6, 22, 33, 4, 17, 43, 11, 8, 32, 19, 33, 35, 13, 24, 1, 26, 39, 21, 47, 12, 27, 17, 5, 19, 43, 7, 40, 21, 22, 12, 45, 34, 3, 47, 14, 11, 44}

    {27, 27, 26, 27, 27, 27, 27, 26, 27, 27, 27, 27, 26, 27, 27, 27, 26, 26, 26, 26, 27, 26, 26, 27, 27, 27, 27, 26, 27, 26, 26, 27, 27, 26, 27, 26, 26, 26, 26, 26, 26, 27, 27}

    Returns: 344592828

  34. 48

    50

    {37, 44, 17, 16, 18, 2, 23, 2, 30, 48, 39, 4}

    {26, 36, 36, 26, 36, 36, 26, 26, 26, 36, 36, 36}

    Returns: 653440482

  35. 48

    47

    {46, 10, 15, 7, 37, 44, 34, 13, 4, 36, 27, 43, 42, 32, 35, 25, 17, 21, 40, 20, 14, 32, 41, 10, 8, 44, 2, 18, 29, 5, 31, 21, 23, 25, 12, 38, 42, 7, 44, 43, 8, 2}

    {30, 34, 30, 32, 30, 5, 34, 5, 30, 34, 34, 30, 32, 30, 32, 34, 5, 30, 34, 34, 30, 5, 32, 32, 32, 34, 34, 30, 30, 5, 30, 32, 32, 5, 32, 5, 30, 5, 30, 34, 34, 30}

    Returns: 134352169

  36. 50

    48

    {}

    {}

    Returns: 918791129

  37. 48

    50

    {39, 20, 19, 37, 28, 10, 32, 8, 19, 8, 11, 44, 17, 13, 1, 47, 47, 41, 29, 29, 22, 49, 23, 46, 22, 9, 35, 0, 11, 33, 46, 26, 2, 0, 42, 0, 26}

    {12, 14, 6, 15, 12, 6, 6, 6, 12, 12, 14, 14, 24, 14, 15, 6, 15, 14, 6, 12, 6, 24, 14, 15, 24, 6, 6, 6, 12, 12, 6, 6, 6, 15, 24, 24, 12}

    Returns: 557007964

  38. 50

    48

    {36, 40, 3}

    {1, 41, 17}

    Returns: 692303998

  39. 48

    49

    {}

    {}

    Returns: 281494203

  40. 49

    49

    {8, 2, 45, 6, 4, 30, 12, 36, 29, 31, 23, 12, 5, 11, 46, 26, 40, 44, 4, 18, 19, 13, 33, 15, 4, 13}

    {46, 42, 10, 24, 12, 12, 46, 46, 16, 16, 12, 12, 24, 16, 10, 16, 12, 46, 16, 42, 10, 12, 24, 12, 46, 24}

    Returns: 546415951

  41. 47

    50

    {30, 35, 30, 35, 25, 47, 25, 47, 30, 35, 47, 35, 25, 47, 30, 47, 30, 35, 25}

    {43, 36, 12, 11, 4, 46, 13, 43, 45, 44, 12, 4, 12, 36, 44, 11, 10, 12, 11}

    Returns: 320727971

  42. 47

    47

    {38, 10, 23, 13, 23, 19, 30, 11, 11, 23, 11, 11, 30, 19, 10, 23, 38, 30, 11, 10, 19, 10, 23, 38, 30, 10, 13, 30, 38}

    {23, 46, 13, 45, 31, 12, 12, 17, 23, 46, 20, 38, 45, 45, 45, 18, 46, 23, 13, 23, 38, 38, 17, 45, 13, 13, 12, 31, 17}

    Returns: 536579913

  43. 50

    47

    {31, 42, 5, 42, 31, 44, 44, 31, 37, 38, 21, 5, 44, 42, 44, 38, 5, 31, 5, 38, 31, 5, 42}

    {11, 5, 16, 11, 38, 32, 38, 16, 5, 34, 39, 30, 13, 34, 34, 36, 5, 30, 11, 39, 39, 32, 30}

    Returns: 141640950

  44. 49

    47

    {41, 18, 46, 10, 39, 43, 7, 34, 36, 23, 22, 45, 23, 10, 45, 16, 36, 15, 7, 35, 24, 35, 26, 24, 24, 37, 18, 18, 20, 40, 44, 24, 38, 39, 10, 32, 13, 2, 15, 3, 3, 43, 37, 33, 16, 42, 17, 1, 30}

    {40, 23, 27, 40, 27, 40, 29, 25, 25, 31, 29, 31, 40, 12, 40, 7, 40, 11, 7, 23, 23, 26, 23, 26, 29, 11, 31, 40, 31, 40, 7, 7, 12, 7, 29, 29, 25, 40, 31, 11, 23, 7, 31, 12, 23, 27, 40, 25, 40}

    Returns: 927033988

  45. 49

    47

    {32, 3, 2, 24, 27, 24, 18, 21, 28, 26, 40, 28, 30, 35, 29, 14, 5, 23, 23, 45, 20, 14, 3, 24, 46, 35, 11, 9, 0, 24, 46}

    {31, 4, 36, 36, 4, 39, 35, 31, 6, 45, 4, 39, 36, 35, 31, 15, 15, 39, 45, 45, 46, 39, 45, 19, 31, 6, 6, 15, 15, 15, 15}

    Returns: 48211463

  46. 48

    50

    {19, 18, 18, 19, 19, 19, 19, 19, 18, 19, 18, 18, 19, 19, 18, 18, 18, 18, 18, 19}

    {43, 20, 32, 15, 24, 27, 33, 42, 31, 5, 43, 5, 20, 32, 15, 24, 27, 33, 42, 31}

    Returns: 744116335

  47. 48

    49

    {48, 45, 7, 27, 0, 13, 30, 0, 8, 38, 46, 40, 18, 21, 46, 25, 20, 20, 9, 30, 0, 0, 33, 5, 44, 13, 37, 23, 6, 38, 5, 47, 4, 19, 9, 25, 19, 30, 32, 35, 11}

    {27, 7, 20, 10, 5, 5, 21, 20, 27, 10, 20, 25, 22, 21, 44, 20, 25, 22, 7, 5, 7, 10, 10, 27, 22, 13, 44, 5, 25, 27, 5, 20, 13, 7, 21, 5, 22, 22, 25, 21, 27}

    Returns: 601351772

  48. 47

    47

    {6, 34, 6, 6, 19, 6, 34, 7, 40, 19, 40, 40, 34, 40, 34, 34, 6, 7, 40, 6, 40, 7, 7, 40, 19, 7, 19, 40}

    {18, 4, 33, 39, 3, 42, 34, 4, 4, 33, 7, 16, 3, 34, 24, 42, 4, 3, 3, 7, 18, 24, 33, 33, 4, 42, 7, 39}

    Returns: 877770884

  49. 47

    47

    {26, 33, 26, 42, 17, 33, 10, 26, 10, 17, 17, 10, 10, 17, 17, 33, 10, 33, 42, 10, 33, 26, 26, 17, 17, 10, 10, 42, 42, 33, 26, 42}

    {21, 42, 36, 5, 21, 5, 18, 5, 21, 36, 42, 36, 42, 5, 14, 4, 5, 7, 13, 14, 13, 7, 13, 4, 7, 7, 13, 15, 21, 21, 18, 42}

    Returns: 592383387

  50. 47

    49

    {20, 16, 31, 22, 22, 37, 10, 20, 7, 43, 18, 37, 10, 32, 30, 41, 27, 27, 19, 10}

    {14, 29, 17, 17, 26, 27, 27, 13, 28, 2, 46, 29, 14, 17, 1, 1, 14, 17, 13, 28}

    Returns: 8729354

  51. 50

    48

    {11, 20, 4, 4, 11, 14, 4, 20, 20, 11, 20, 4, 20, 20, 14, 4}

    {10, 43, 9, 6, 9, 10, 41, 20, 16, 41, 6, 28, 19, 9, 28, 7}

    Returns: 954238040

  52. 47

    50

    {22, 27, 28, 17, 15, 3, 5, 0, 45, 33, 13, 3, 35, 41, 17, 11, 21, 47, 10, 43, 32, 1, 5, 19, 16, 6, 3, 34, 16, 37, 31, 44, 31, 40, 10, 35, 25, 16, 10, 28, 18, 40, 2, 18, 40, 31}

    {5, 1, 0, 0, 39, 10, 10, 5, 31, 5, 2, 31, 5, 15, 27, 26, 15, 15, 2, 5, 5, 5, 27, 26, 15, 10, 2, 5, 27, 1, 27, 0, 39, 39, 1, 0, 2, 2, 10, 31, 2, 2, 15, 5, 5, 2}

    Returns: 6703816

  53. 50

    48

    {30, 32, 30, 32, 30, 32, 30, 30, 32, 32, 32, 30, 30}

    {30, 30, 42, 33, 16, 42, 35, 3, 16, 10, 48, 2, 11}

    Returns: 82773746

  54. 50

    48

    {6, 39, 6, 37, 6, 39, 29, 37, 19, 3, 3, 19, 6, 37, 39, 29, 19, 37, 37, 7, 37, 19, 39, 7, 29, 3, 6, 3, 37, 7, 29, 19, 3, 29, 7, 3, 6, 39, 19, 39, 29, 37, 37, 29, 3, 7, 29, 7, 19}

    {12, 12, 30, 12, 39, 39, 41, 30, 12, 31, 40, 30, 2, 39, 8, 1, 39, 2, 5, 31, 8, 31, 41, 40, 40, 30, 1, 39, 41, 12, 12, 41, 5, 30, 30, 8, 31, 31, 1, 40, 39, 31, 40, 2, 41, 5, 5, 8, 40}

    Returns: 998647835

  55. 49

    48

    {17, 43, 4, 17, 2, 4, 17, 29, 43, 43, 43, 13, 2, 13, 46, 29, 17, 29, 17, 29, 17, 43, 43, 2, 29, 29, 2, 46, 2, 13, 46, 2, 13, 4}

    {46, 46, 3, 0, 39, 6, 6, 44, 6, 12, 36, 44, 47, 47, 47, 46, 29, 0, 47, 12, 44, 44, 47, 46, 36, 39, 0, 6, 3, 3, 3, 6, 6, 46}

    Returns: 173442064

  56. 49

    48

    {2, 39, 28, 30, 37, 11, 16, 24, 29, 3, 36, 10, 27, 1, 42, 19, 8, 26, 39, 39, 25, 4, 38, 34, 28, 29, 14, 8, 32, 25}

    {48, 42, 15, 15, 36, 20, 16, 26, 25, 3, 3, 48, 3, 48, 13, 20, 26, 13, 13, 25, 42, 16, 42, 20, 16, 42, 20, 13, 16, 20}

    Returns: 201371058

  57. 48

    47

    {15, 36, 5, 4, 14, 29, 37, 16, 30, 25, 7, 29, 43, 31, 21, 42, 23, 34, 1, 12, 21, 15, 9, 42, 33, 36, 12, 25, 15, 11, 24, 13, 46, 25, 15, 24, 29, 15, 25, 14, 8, 28, 10, 43, 32, 8, 8, 32, 2, 9}

    {24, 1, 7, 15, 19, 44, 24, 7, 24, 19, 1, 7, 24, 1, 12, 44, 12, 12, 36, 15, 24, 44, 7, 7, 7, 24, 36, 12, 7, 28, 19, 19, 19, 24, 19, 28, 15, 28, 36, 8, 1, 19, 7, 7, 7, 19, 28, 19, 15, 36}

    Returns: 327796057

  58. 48

    49

    {33, 8, 33, 36, 36, 8, 8, 36, 33, 36, 8, 33, 33, 36, 36, 36, 33, 36, 8, 33, 33, 8, 8, 33, 36, 8}

    {42, 46, 45, 1, 22, 21, 24, 40, 24, 46, 39, 41, 1, 24, 39, 42, 22, 45, 41, 40, 46, 1, 22, 21, 41, 40}

    Returns: 369190917

  59. 48

    48

    {4, 8, 16, 8, 2, 4, 9, 2, 43, 9, 4, 16, 8, 16, 8, 8, 8, 9}

    {4, 14, 26, 4, 46, 3, 38, 26, 4, 26, 31, 2, 38, 21, 2, 31, 34, 4}

    Returns: 241856089

  60. 49

    47

    {10, 46, 12, 23, 10, 16, 4, 1, 12, 16, 16, 12, 23, 10, 4, 12, 16, 1, 10, 4, 16, 1, 46, 12, 12, 4, 46, 4, 10, 46, 1, 16, 4, 10, 10, 16, 1, 1, 46, 4, 10, 23, 12, 1, 12, 10, 46, 1}

    {37, 30, 7, 7, 43, 32, 12, 43, 19, 41, 47, 37, 37, 12, 30, 43, 7, 12, 30, 42, 19, 42, 47, 30, 42, 32, 7, 41, 32, 19, 32, 30, 7, 47, 41, 42, 47, 41, 43, 19, 7, 32, 32, 7, 41, 19, 12, 19}

    Returns: 145497346

  61. 49

    47

    {15, 14, 45, 36, 37, 3, 12, 28, 37, 46, 36, 28, 5, 27, 31, 4, 11, 20, 31, 19, 14, 34, 24, 42, 4, 35, 38, 16, 24, 13, 28, 29, 30, 17, 4, 19, 0, 2, 8, 15}

    {21, 4, 13, 13, 21, 25, 25, 21, 33, 5, 37, 33, 37, 40, 4, 5, 47, 25, 25, 5, 21, 33, 4, 25, 47, 25, 15, 33, 40, 40, 4, 33, 4, 13, 25, 13, 15, 15, 37, 15}

    Returns: 424051191

  62. 50

    48

    {32, 32, 26, 47, 32, 47, 26, 47, 26, 26, 47, 32, 26, 32, 26, 47, 47, 47, 32}

    {43, 49, 48, 46, 27, 43, 14, 49, 17, 32, 27, 17, 16, 32, 46, 14, 17, 32, 13}

    Returns: 478839797

  63. 50

    50

    {46, 28, 10, 10, 28, 20, 28, 10, 10, 10, 28, 10, 11, 22, 20, 22, 20, 20, 22, 22, 11, 28, 11, 11, 20, 46, 11, 46, 46, 46, 22, 20, 11, 22, 46, 28}

    {24, 46, 40, 46, 15, 44, 24, 15, 24, 30, 45, 45, 44, 19, 40, 40, 49, 46, 43, 49, 19, 44, 40, 43, 15, 40, 46, 43, 49, 46, 30, 45, 15, 45, 15, 43}

    Returns: 165399585

  64. 48

    49

    {46, 37, 39, 17, 23, 46, 25, 10, 0, 27, 6, 1, 12, 16, 5, 38, 45, 12, 3, 19, 47, 40, 42, 17, 42, 18, 41, 29, 35, 24, 38, 36, 0, 18, 34, 26, 44, 33, 4, 36, 29, 44, 31}

    {30, 3, 24, 30, 43, 14, 13, 24, 29, 43, 14, 30, 3, 31, 3, 43, 24, 24, 24, 14, 30, 43, 13, 29, 28, 3, 29, 3, 28, 31, 30, 2, 43, 30, 14, 43, 3, 3, 31, 29, 2, 24, 2}

    Returns: 228662561

  65. 47

    47

    {38, 38, 3, 3, 38, 44, 44, 38, 44, 38, 44, 3, 44, 3, 44, 38, 3, 38, 3, 3, 3, 38, 44, 44}

    {26, 35, 7, 13, 41, 2, 14, 7, 26, 13, 35, 15, 7, 27, 13, 15, 2, 27, 14, 29, 35, 2, 15, 27}

    Returns: 909379718

  66. 50

    50

    {1, 0, 5, 4, 0, 2, 3, 8, 2, 4, 6, 4, 3, 6, 8, 5, 9, 5, 9, 1, 0, 4, 2, 3, 9, 0, 0, 9, 8, 0, 0, 5, 4, 3, 9, 5, 2, 0, 6, 1, 7, 9, 1, 9, 2, 7, 8, 8, 2, 7 }

    {2, 1, 6, 9, 0, 7, 6, 6, 9, 5, 5, 6, 2, 8, 2, 1, 6, 4, 0, 7, 8, 7, 2, 4, 7, 7, 6, 4, 9, 4, 2, 2, 2, 5, 5, 8, 5, 3, 9, 6, 0, 9, 4, 3, 4, 1, 3, 8, 0, 2 }

    Returns: 203930993


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: