Statistics

Problem Statement for "BeautifulBanknotes"

Problem Statement

The time limit for this task is 5 seconds.


Absurdistan has N different banknote types.

There is a canonical order of all types by beauty, and the types are numbered from 0 (most beautiful) to N-1 (ugliest) in this order.

Each banknote type has a positive integer value. The values are unrelated to the banknotes' beauty, and they are not necessarily distinct. You are given their list in the int[] values.


A stunning collection of banknotes has the property that an uglier type cannot have more pieces in the collection than a more beautiful type. This rule also applies to types that aren't present in the collection: for example, a collection that has no banknotes of type 3 and two banknotes of type 4 is not stunning.

A tolerable collection of banknotes has the property that at most one type of banknotes prevents it from being stunning by having too many pieces. I.e., if the collection is not stunning but can be turned into a stunning collection by removing one or more banknotes, all of the same type, it is still considered tolerable.

Note that the definition says "at most one type", hence each stunning collection is also a tolerable collection.

For example, if we have banknotes of types 0, 0, 1, 2, 2, 2, 2, 2, 3, 4, we have a collection that is tolerable (but not stunning) as we can fix it by removing some banknotes of type 2.

The collection 0, 1, 2, 2, 3, 3 is not tolerable: you have too many banknotes of type 2, but if you remove some of them, you will have too many banknotes of type 3.


Count all tolerable collections of banknotes with the total value total. Return that count modulo 10^9 + 7.

Definition

Class:
BeautifulBanknotes
Method:
count
Parameters:
int[], int
Returns:
int
Method signature:
int count(int[] values, int total)
(be sure your method is public)

Constraints

  • values will have between 1 and 100 elements, inclusive.
  • Each element of values will be between 1 and 100,000, inclusive.
  • total will be between 1 and 800,000, inclusive.

Examples

  1. {1, 1}

    7

    Returns: 8

    Two banknote types, each worth $1. Each of the eight possible collections of 7 banknotes is a valid solution: those with more pieces of type 0 are stunning and the others are just tolerable.

  2. {1, 1, 1}

    5

    Returns: 16

    Here it is not true that all possible collections of five banknotes are good. For example: the collection 0, 0, 1, 1, 2 (i.e., two banknotes of type 0, two of type 1 and one of type 2) is stunning and therefore tolerable the collection 0, 0, 0, 0, 1 is also stunning the collection 1, 1, 1, 1, 1 is tolerable, because if we remove all banknotes of type 1, we have a collection with zero banknotes of each type and that one is stunning the collection 0, 0, 2, 2, 2 is also tolerable (remove all banknotes of type 2 to make it stunning) the collection 0, 0, 1, 2, 2 is also tolerable (remove one or two banknotes of type 2 to make it stunning) the collection 1, 1, 1, 2, 2 is not tolerable

  3. {10, 20, 30, 40, 50}

    99947

    Returns: 0

    If all banknote values are multiples of ten, there is no collection with total value 99947.

  4. {5, 1, 2, 5, 4, 2}

    47

    Returns: 374

    One of the stunning collections consists of nine banknotes of type 0 and two of type 1. Another stunning collection consists of three banknotes of each of the types 0, 1, 2, 3 and two banknotes of type 4. One of the tolerable collections consists of nine banknotes of type 0 and a single banknote of type 2. Another tolerable collection looks like the previous one except there is a banknote of type 5 instead of a banknote of type 2. Yet another tolerable collection consists of the following banknote types: 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5. (If we had one fewer banknote of type 3, this collection would be stunning.)

  5. {1, 1, 1}

    77777

    Returns: 16524266

    Don't forget to do all calculations modulo 10^9 + 7.

  6. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}

    800000

    Returns: 473335161

  7. {1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}

    799997

    Returns: 47748812

  8. {100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000}

    100000

    Returns: 100

  9. {3}

    333

    Returns: 1

  10. {3}

    332

    Returns: 0

  11. {100000}

    1

    Returns: 0

  12. {453, 8, 502, 188, 3, 137, 26, 13, 11, 124, 2212, 369, 332, 37, 6, 2183, 108, 62, 19, 27, 12, 2132, 277, 21, 127, 41, 1, 567, 166, 1130, 14, 4, 61, 1, 3, 12, 2253, 2279, 363, 726, 1136, 31, 1, 616, 638, 195, 1071, 43, 2, 1, 1, 9, 1837, 31, 1238, 504, 2169, 693, 1, 1155, 38, 174, 5, 4, 28, 14, 736, 8, 81, 1210, 1, 1124, 13, 1407, 67, 1314, 4, 2, 432, 22, 279, 197, 5, 93, 518, 8, 365, 1844, 1729, 8, 561, 2, 75, 458, 2, 830}

    799053

    Returns: 87320685

  13. {471, 2450, 5541, 542, 1, 23, 4, 15198, 15123, 28, 331, 4, 4, 19, 41, 25, 26516, 15560, 1, 1791, 7180, 3, 30, 4926, 3441, 1, 2703, 24, 425, 10019, 86, 27555, 10, 3, 5504, 4535, 304, 22, 455, 439, 14, 2969, 768, 968, 21, 1585, 12, 68, 127, 4286, 14, 737, 5, 834, 2534, 6, 23326, 3, 900, 286, 6, 23601, 838, 12268, 94, 1, 1713, 2804, 63, 4, 7898, 608, 1602, 6, 1965, 676, 174, 2991, 2, 1, 1, 468, 2, 22517, 139, 7800, 47, 419, 127, 24752, 1262, 193, 2, 242, 1466}

    799331

    Returns: 114709457

  14. {2619, 5, 554, 37, 25421, 12, 127, 189, 488, 705, 11047, 505, 121, 1, 5562, 35, 104, 747, 3, 203, 43, 810, 28, 5932, 461, 1710, 7662, 18, 188, 1, 6577, 290, 172, 2390, 399, 70, 48023, 57, 359, 52, 24, 39237, 779, 28, 173, 6, 84639, 2, 77, 127, 6573, 1, 3768, 9, 1556, 255, 1, 221, 253, 2874, 61, 3, 23980, 8489, 9272, 45440, 5632, 254, 67074, 53362, 896, 91, 58977, 29, 2100, 334, 70, 55, 162, 155, 2258, 21, 6312, 73775, 1954, 13, 1, 31686, 2600, 1, 3, 46270, 2, 64189}

    799437

    Returns: 389864250

  15. {1, 2, 1, 1, 3, 1, 1, 3, 1, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 3, 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, 3, 3, 3, 2, 2, 1, 1, 1, 1, 2, 1, 2, 3, 2, 2, 1, 1, 1, 3, 2, 3, 2, 1, 1, 1, 1, 3, 3, 3, 3, 2, 1, 1, 1, 2, 1, 3, 2, 1, 2, 1, 2, 1, 3, 2, 2, 1, 2, 3, 1, 1, 2, 2, 3, 1, 3, 1, 2, 1, 1, 3, 1, 3}

    799837

    Returns: 719427686

  16. {1, 1, 19, 27, 21, 60, 1, 1, 1, 23, 3, 2, 1, 3, 15, 36, 3, 1, 12, 48, 20, 3, 34, 47, 14, 28, 51, 1, 11, 3, 1, 1, 14, 49, 2, 6, 7, 1, 2, 3, 30, 17, 3, 39, 2, 1, 5, 7, 37, 3, 25, 28, 1, 5, 7, 2, 1, 4, 28, 61, 37, 1, 4, 6, 9, 24, 2, 6, 1, 3, 5, 5, 3, 1, 11, 40, 8, 1, 3, 2, 16, 48, 15, 2, 2, 5, 5, 36, 1, 2, 1, 36, 35, 10, 57, 15, 34, 17, 23}

    799015

    Returns: 47229414

  17. {4628, 88, 3775, 3619, 7, 1403, 66, 12, 35, 1172, 1, 857, 297, 1459, 2078, 4, 2642, 225, 5108, 6, 351, 3747, 4, 256, 197, 1, 3447, 280, 2, 7433, 10747, 194, 2, 516, 5663, 221, 1, 446, 287, 18, 118, 2809, 40, 5, 105, 1, 7893, 7, 27, 325, 4, 12, 510, 70, 3921, 2128, 119, 1, 26, 15, 1, 65, 1174, 3582, 7390, 17, 433, 7, 13, 15, 810, 4, 7, 127, 52, 27, 2898, 1489, 2, 2245, 1995, 235, 1, 218, 59, 2005, 12, 2372, 918, 29, 10}

    799724

    Returns: 474047314

  18. {5, 25, 42, 1, 2, 4, 75, 22, 24, 1, 29, 5, 40, 1, 4, 27, 14, 1, 74, 74, 14, 62, 3, 1, 19, 5, 4, 3, 49, 2, 4, 20, 75, 1, 3, 1, 12, 25, 3, 29, 3, 1, 9, 14, 73, 60, 1, 51, 6, 2, 3, 1, 6, 1, 30, 57, 74, 3, 1, 7, 28, 2, 75, 28, 3, 59, 39, 23, 54, 3, 10, 1, 2, 1, 62, 9, 21, 8, 2, 7, 60, 44, 5, 28, 10, 2, 28, 2, 32, 27, 51, 5, 3, 2, 10, 1}

    799608

    Returns: 521292493

  19. {35, 4, 8, 2, 169, 61, 5, 5, 2, 2, 19, 5, 7, 99, 94, 13, 2, 76, 79, 406, 1, 109, 52, 18, 3, 25, 3, 483, 2, 3, 456, 30, 407, 1, 4, 1, 330, 1, 1, 33, 383, 18, 251, 23, 31, 93, 125, 1, 168, 132, 20, 231, 417, 53, 31, 31, 361, 375, 239, 42, 11, 13, 64, 3, 7, 1, 477, 42, 11, 4, 23, 84, 94, 1, 2, 25, 4, 6, 425, 225, 78, 118, 460, 28, 36, 1, 415, 31, 3, 6, 1, 406, 6, 3, 24, 26, 7, 66, 2, 360}

    799724

    Returns: 491797483

  20. {7, 3, 4, 3, 1, 3, 1, 1, 5, 1, 1, 1, 3, 7, 1, 3, 2, 3, 1, 3, 3, 3, 2, 1, 2, 1, 4, 5, 1, 1, 4, 1, 1, 1, 4, 3, 7, 4, 2, 1, 5, 5, 7, 1, 5, 6, 1, 2, 4, 3, 4, 5, 1, 1, 5, 6, 1, 5, 2, 4, 7, 1, 7, 6, 1, 7, 3, 5, 1, 2, 4, 2, 5, 7, 3, 3, 4, 2, 4, 1, 1, 2, 6, 2, 5, 7, 3, 6, 4, 7, 7, 1, 1, 2, 2}

    799887

    Returns: 645033048

  21. {5, 1, 36, 69, 1, 86, 1, 19, 3, 100, 3, 42, 67, 50, 30, 1, 1, 231, 1, 17, 1, 44, 25, 215, 56, 58, 1, 6, 13, 54, 2, 356, 4, 44, 57, 5, 24, 17, 1, 1, 6, 44, 9, 3, 1, 1, 90, 12, 12, 2, 4, 41, 4, 2, 6, 31, 2, 3, 200, 63, 3, 5, 25, 4, 30, 363, 1, 1, 60, 1, 131, 67, 3, 377, 3, 11, 184, 71, 13, 1, 12, 25, 1, 138, 138, 3, 1, 3, 12, 14, 17}

    799440

    Returns: 194816148

  22. {3, 3, 1, 3, 3, 2, 1, 2, 1, 1, 2, 1, 1, 3, 1, 3, 1, 1, 1, 3, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 3, 1, 1, 3, 3, 2, 1, 2, 1, 1, 1, 1, 1, 3, 3, 3, 2, 3, 3, 1, 2, 2, 3, 1, 1, 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 3, 1, 1, 1, 2, 1, 3, 1, 3, 2, 2, 1, 1, 2, 2, 1, 3, 2, 1, 1, 2, 1, 1, 1, 1}

    799182

    Returns: 760183420

  23. {2, 2, 1016, 1, 3, 364, 1, 17, 329, 197, 498, 236, 101, 70, 3, 15, 224, 26, 288, 35, 12, 200, 351, 108, 109, 3, 317, 150, 275, 86, 891, 701, 984, 227, 935, 96, 61, 10, 9, 13, 1, 21, 11, 4, 155, 5, 95, 14, 1, 140, 73, 3, 21, 41, 638, 16, 185, 81, 1, 934, 41, 1012, 18, 14, 15, 1, 71, 536, 59, 9, 9, 4, 591, 490, 235, 1, 19, 858, 10, 475, 5, 164, 220, 3, 1, 3, 395, 929, 16, 118, 128, 358, 13, 43, 99, 49, 403, 29, 7}

    799474

    Returns: 734867024

  24. {15, 16, 1, 259, 145, 188, 7, 367, 1412, 31, 5, 99, 3, 1, 1239, 662, 1012, 3, 1013, 54, 427, 40, 1, 843, 5, 1, 340, 18, 19, 4, 1, 31, 3, 18, 68, 4, 41, 2, 1054, 4, 676, 2, 511, 1, 6, 147, 7, 369, 21, 1, 45, 112, 311, 41, 15, 10, 7, 1528, 20, 20, 6, 29, 666, 24, 58, 7, 711, 1118, 20, 209, 7, 494, 1, 240, 429, 14, 29, 139, 403, 304, 22, 14, 17, 1, 1304, 714, 376, 305, 5, 708, 10, 9, 202, 45, 4, 34, 49, 125, 5}

    799609

    Returns: 288039415

  25. {1, 2, 2, 4, 2, 1, 3, 4, 1, 7, 2, 9, 3, 4, 8, 1, 4, 9, 3, 1, 1, 1, 8, 1, 1, 1, 10, 2, 3, 1, 1, 3, 5, 6, 3, 3, 7, 1, 1, 10, 4, 5, 5, 4, 1, 3, 2, 1, 8, 1, 6, 7, 1, 4, 2, 8, 2, 9, 10, 1, 5, 7, 1, 1, 3, 3, 6, 1, 1, 2, 3, 4, 6, 6, 7, 6, 9, 2, 10, 2, 2, 5, 2, 5, 1, 5, 5, 1, 1, 3, 6, 3, 5, 1, 7, 3, 3, 10, 1, 2}

    799055

    Returns: 725546951

  26. {3, 3, 1, 30, 23, 25, 1, 1, 1, 9, 28, 6, 2, 4, 1, 22, 8, 7, 8, 19, 1, 5, 5, 2, 1, 4, 7, 17, 6, 1, 1, 27, 8, 5, 2, 29, 4, 3, 10, 2, 1, 3, 2, 22, 1, 1, 3, 5, 2, 21, 1, 14, 1, 1, 16, 2, 2, 27, 5, 28, 3, 5, 15, 1, 8, 22, 12, 2, 7, 2, 24, 2, 1, 17, 18, 28, 1, 7, 13, 2, 2, 25, 1, 5, 2, 21, 8, 23, 3, 1, 26, 21, 10, 3, 3, 4, 1}

    799225

    Returns: 698680851

  27. {68, 51, 63, 29, 53, 2, 6, 1, 53, 14, 12, 7, 3, 1, 1, 2, 21, 2, 6, 8, 27, 6, 5, 19, 3, 14, 55, 52, 22, 4, 4, 27, 7, 2, 26, 1, 36, 2, 3, 3, 13, 26, 3, 51, 42, 1, 41, 15, 16, 4, 1, 29, 18, 6, 7, 14, 49, 17, 1, 51, 63, 29, 11, 26, 10, 2, 3, 34, 4, 11, 43, 26, 1, 7, 1, 9, 66, 8, 14, 13, 3, 3, 3, 23, 5, 6, 11, 14, 50, 18, 1, 3, 11, 4, 27, 21}

    799587

    Returns: 885494500

  28. {91, 197, 452, 387, 12, 14, 1, 8, 47, 52, 17, 108, 1, 112, 6, 382, 2, 42, 4, 2, 154, 13, 3, 13, 249, 1, 34, 2, 261, 11, 4, 1, 2, 21, 2, 1, 232, 5, 203, 141, 92, 7, 19, 3, 391, 10, 384, 27, 1, 13, 227, 1, 122, 1, 46, 192, 10, 1, 3, 3, 1, 13, 2, 106, 3, 12, 5, 33, 1, 6, 129, 21, 4, 238, 178, 16, 371, 1, 15, 358, 2, 1, 20, 118, 436, 2, 1, 24, 42, 4, 5, 1, 125, 1, 7}

    799951

    Returns: 848776178

  29. {10, 38, 3, 117, 71, 71, 3, 1, 53, 21, 59, 1, 11, 33, 65, 198, 48, 6, 2, 1, 18, 84, 2, 60, 3, 1, 2, 1, 8, 5, 29, 15, 69, 2, 83, 27, 1, 4, 7, 12, 24, 10, 6, 57, 47, 11, 1, 12, 5, 6, 9, 7, 1, 145, 6, 3, 18, 5, 71, 50, 40, 1, 1, 21, 1, 3, 36, 1, 2, 22, 1, 7, 7, 27, 145, 172, 58, 81, 6, 2, 14, 5, 21, 29, 5, 98, 29, 3, 1, 4, 127, 12}

    799424

    Returns: 904462018

  30. {50, 35, 6, 318, 2, 11, 341, 3, 14, 3, 3462, 268, 282, 29, 5, 642, 745, 2130, 173, 238, 1255, 23, 24, 330, 330, 63, 1607, 5, 598, 946, 15, 160, 12, 610, 3763, 2, 229, 372, 12, 468, 37, 192, 4576, 105, 1190, 2, 92, 134, 129, 40, 91, 3, 209, 900, 9, 26, 10, 11, 3863, 79, 14, 4, 1346, 24, 3, 44, 8, 15, 5, 1, 3, 248, 1, 58, 6, 2, 3436, 7, 1, 6, 35, 18, 316, 328, 69, 20, 178, 2414, 2286, 13, 23, 3187, 216, 182, 8, 213, 27, 908, 11, 31}

    799184

    Returns: 239284381

  31. {4, 4, 15, 10, 4, 2, 1, 1, 13, 5, 7, 3, 1, 1, 10, 1, 18, 11, 16, 2, 2, 1, 2, 1, 4, 14, 3, 2, 6, 15, 1, 7, 1, 13, 1, 1, 4, 2, 5, 1, 14, 15, 1, 7, 1, 15, 1, 3, 14, 10, 4, 12, 8, 7, 10, 18, 3, 15, 9, 1, 1, 1, 3, 4, 3, 1, 3, 10, 3, 12, 6, 14, 7, 2, 15, 3, 3, 3, 6, 1, 1, 6, 5, 12, 1, 9, 3, 1, 12, 1, 9, 8, 6, 6, 3, 3}

    799998

    Returns: 952367725

  32. {82, 57576, 370, 43, 237, 16, 6978, 30, 8, 242, 106, 209, 9, 386, 829, 1954, 13039, 451, 4745, 4, 1, 11204, 9, 252, 657, 5, 23, 54, 38, 3, 25, 204, 2521, 41, 28, 956, 1, 997, 7016, 15773, 1033, 6589, 243, 2389, 1621, 15, 58260, 13, 2720, 116, 1, 53, 46024, 2, 8, 26, 713, 63, 8806, 349, 477, 2, 543, 90, 3, 17, 4806, 2, 28, 112, 216, 1, 4, 1582, 1, 7808, 227, 1463, 9965, 1657, 14, 117, 22239, 674, 897, 1867, 1, 40, 4, 35, 546, 490, 2, 12385, 157, 45, 43765, 1, 9}

    799890

    Returns: 222798580

  33. {47, 413, 99, 167, 268, 73, 9, 23, 12, 254, 31, 58, 1, 731, 43, 42, 3, 14, 39, 96, 10, 522, 64, 471, 835, 671, 21, 166, 86, 422, 1, 223, 189, 24, 28, 60, 543, 61, 461, 31, 8, 752, 1, 3, 121, 344, 224, 3, 442, 44, 474, 689, 19, 3, 291, 1, 4, 1, 60, 7, 220, 2, 88, 7, 96, 2, 3, 76, 1, 10, 143, 13, 199, 105, 616, 791, 111, 3, 3, 1, 63, 1, 168, 13, 3, 35, 9, 32, 1, 777}

    799180

    Returns: 807623010

  34. {6, 17, 1, 18, 11, 23, 11, 9, 12, 4, 2, 27, 15, 10, 31, 61, 1, 4, 45, 64, 6, 2, 62, 10, 15, 13, 34, 5, 2, 1, 7, 46, 7, 9, 1, 1, 5, 11, 1, 8, 55, 16, 24, 1, 36, 38, 29, 6, 7, 10, 4, 1, 25, 40, 11, 1, 14, 1, 1, 15, 6, 11, 20, 63, 7, 65, 1, 12, 1, 3, 6, 51, 4, 47, 4, 10, 2, 19, 68, 59, 5, 5, 59, 3, 22, 1, 2, 9, 46, 14, 1, 1}

    799086

    Returns: 30001021

  35. {1943, 4079, 56, 12, 12, 1952, 5141, 361, 27, 142, 3691, 1, 14, 1, 4, 2, 3, 3, 303, 236, 135, 204, 109, 14, 1, 20, 463, 1, 1259, 58, 2391, 410, 6, 719, 1, 2905, 103, 1746, 8, 14, 4, 194, 92, 2, 1756, 58, 42, 84, 1975, 14, 4, 152, 2, 3653, 1, 9, 94, 966, 119, 206, 6, 1228, 1, 3, 4583, 717, 1901, 4, 30, 34, 1605, 598, 20, 15, 716, 437, 7114, 4328, 100, 130, 1622, 7, 137, 6, 139, 1343, 751, 6, 3108, 82}

    799398

    Returns: 755786110

  36. {3, 1, 3, 1, 1, 1, 4, 1, 4, 3, 2, 5, 4, 1, 3, 3, 5, 2, 1, 1, 2, 5, 2, 3, 5, 2, 4, 1, 1, 2, 2, 5, 4, 1, 2, 1, 1, 5, 1, 2, 2, 1, 3, 1, 3, 4, 2, 5, 1, 1, 1, 5, 3, 1, 1, 4, 4, 1, 3, 1, 4, 1, 1, 4, 2, 1, 3, 3, 2, 1, 4, 1, 3, 4, 1, 3, 5, 1, 1, 2, 3, 1, 3, 1, 4, 2, 3, 1, 5, 4, 4}

    799072

    Returns: 50312322

  37. {176, 27, 200, 415, 36, 37, 14, 19, 26, 4, 302, 255, 394, 7, 62, 5, 2, 2, 101, 1, 109, 68, 1, 2, 4, 2, 43, 128, 3, 1, 3, 3, 21, 3, 11, 56, 633, 533, 185, 5, 430, 99, 106, 19, 226, 10, 311, 175, 6, 14, 1, 30, 4, 6, 2, 42, 3, 1, 489, 26, 87, 1, 166, 2, 58, 48, 297, 3, 9, 15, 3, 6, 88, 13, 391, 626, 719, 128, 3, 817, 98, 2, 47, 1, 3, 7, 534, 29, 98, 10, 3, 6, 164, 100, 368, 2, 26, 5, 15, 13}

    799776

    Returns: 452580456

  38. {1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 2}

    799630

    Returns: 603405126

  39. {3, 9, 22, 19, 1, 8, 1, 7, 9, 11, 3, 3, 5, 4, 39, 3, 1, 14, 6, 2, 1, 5, 36, 3, 1, 29, 3, 19, 34, 11, 20, 10, 15, 3, 7, 27, 25, 3, 11, 5, 31, 1, 24, 32, 5, 12, 17, 32, 1, 3, 8, 1, 30, 14, 10, 1, 22, 5, 41, 17, 5, 3, 5, 3, 7, 3, 2, 2, 19, 1, 8, 2, 15, 1, 4, 3, 26, 4, 36, 5, 1, 22, 4, 6, 20, 16, 1, 25, 29, 8, 1, 26, 2}

    799976

    Returns: 687342799

  40. {19341, 110, 78, 2399, 3, 10, 54, 1, 16430, 1755, 58, 1, 64, 2, 5506, 44, 4498, 15701, 38, 1, 25, 471, 24126, 2, 33, 24995, 3700, 20, 10, 790, 96, 1, 9, 14792, 1084, 196, 3, 496, 175, 168, 643, 53, 1901, 12, 4675, 3970, 34, 100, 510, 14733, 7, 1, 14775, 1481, 3, 19430, 917, 29, 3, 985, 206, 2968, 343, 38, 426, 148, 850, 249, 115, 10, 1, 16, 57, 4081, 11, 26083, 3972, 36, 27901, 29207, 546, 11, 71, 14, 2, 874, 4208, 110, 93, 872, 4355, 15, 100, 50, 48, 15054, 5505, 20411, 2, 3482}

    799608

    Returns: 356929214

  41. {1, 3, 2, 3, 2, 3, 15, 6, 3, 14, 2, 15, 5, 5, 1, 6, 12, 2, 7, 15, 3, 1, 3, 13, 3, 4, 1, 1, 4, 5, 2, 2, 1, 5, 2, 2, 7, 9, 10, 5, 1, 3, 3, 3, 9, 3, 6, 3, 2, 2, 1, 3, 10, 1, 3, 3, 5, 9, 1, 1, 6, 1, 9, 1, 9, 1, 10, 8, 1, 10, 2, 11, 3, 4, 10, 9, 1, 1, 1, 8, 14, 2, 3, 4, 1, 1, 8, 2, 2, 1, 1, 4, 4}

    799629

    Returns: 509931753


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: