Statistics

Problem Statement for "LollipopHoney"

Problem Statement

Yui loves lollipops. She has a precious collection of tasty lollipops.

Each lollipop has some flavor and some level of deliciousness. Both parameters are represented by positive integers.

You are given the information about Yui's collection in the int[]s flavor and deliciousness. For each i, flavor[i] and deliciousness[i] represent one lollipop in the collection.

Yui wants to give 2K lollipops to her best friend as a birthday present. She wants to satisfy the following conditions:

  • It must be possible to split the lollipops into K pairs such that within each pair the two lollipops have different flavors.
  • The total deliciousness of all 2K selected lollipops must be maximized.

If Yui cannot select K pairs of lollipops meeting the conditions, return an empty int[]. Otherwise, return a int[] with two elements: Element 0 should be the largest possible total deliciousness of selected lollipops, and element 1 should be the number of ways in which the set of 2K lollipops can be selected, modulo 1,000,000,007.

Definition

Class:
LollipopHoney
Method:
count
Parameters:
int, int[], int[]
Returns:
int[]
Method signature:
int[] count(int K, int[] flavor, int[] deliciousness)
(be sure your method is public)

Notes

  • Two ways of selecting lollipops differ if and only if there exists a lollipop which is selected in one way and not in the other way.

Constraints

  • N will be between 2 and 50, inclusive.
  • K will be between 1 and N/2, inclusive.
  • flavor will contain exactly N elements.
  • deliciousness will contain exactly N elements.
  • Each element in flavor will be between 1 and 50, inclusive.
  • Each element in deliciousness will be between 1 and 10^7, inclusive.

Examples

  1. 1

    {1,1,2,2}

    {10,20,30,40}

    Returns: {60, 1 }

    Yui must select lollipop 1 (flavor 1, deliciousness 20) and lollipop 3 (flavor 2, deliciousness 40). The total deliciousness is 20+40 = 60, and this solution is unique.

  2. 2

    {1,1,1,2,2,2}

    {10,10,10,20,20,20}

    Returns: {60, 9 }

    Yui must select two of the three lollipops with flavor 1 and two of the three lollipops with flavor 2. Note that she cannot select three lollipops with flavor 2 and one element with flavor 1: the total deliciousness would be higher, but she would not be able to create two pairs of lollipops such that within each pair the flavors are distinct.

  3. 2

    {1,1,1,1,1,2}

    {10,20,30,40,50,60}

    Returns: { }

    Here, Yui is unable to select 2K lollipops with the desired properties.

  4. 3

    {48,33,22,9,37,44,5,49,24,14,45,1}

    {9,1,7,10,7,10,5,1,3,3,4,5}

    Returns: {48, 2 }

  5. 10

    {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40}

    {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}

    Returns: {20, 846527861 }

    Please don't forget to use modulo 1,000,000,007 when computing the number of ways.

  6. 7

    {26,4,1,38,13,10,2,15,49,22,43,50,11,31,44,40,2,32,5,33,44,27,33,42,45,17,46,3,8,21,20,5,50,2,28,1,33,34,39,36,15,48,34,18,21,3,49,33,7,9}

    {2245979,7843118,5952215,667367,779755,394156,3050515,9000683,5999804,1531573,8077988,6968857,1184768,5238098,7937893,6690789,6485689,6953620,9721637,3541379,4444223,9190642,3755045,6850997,1196614,5834996,3563492,580067,8412970,7515255,4159315,4183940,4988371,1325038,8871092,3144637,5981889,4397247,2521680,8218896,8160016,6773770,6909328,6235721,136846,4201272,3219652,7642395,5827913,8464063}

    Returns: {116025505, 1 }

  7. 4

    {3,29,5,43,43,30,23,36,16,39,26,47,16,36,16,6,45,44,45,44,24,43,30,40,41,48,43,50,3,20,23,39,42,4,32,32,10,27,34,39,1,46,38,17,47,24,43,29,44,26}

    {3507994,4380251,3416,7159210,8994484,1293936,3517188,8870487,4070376,264611,4743895,4100674,8047628,3726190,2997136,6722790,3407049,2621165,7917894,4756219,4192674,1422,7682717,307063,3710771,6249852,6033117,9629861,6315148,7805671,5620461,1948213,2167460,5420161,4940916,1434557,1484880,5126627,7049567,7895138,1922884,8019850,4544492,8787219,2317527,7962466,5549609,9443411,4327856,7827509}

    Returns: {69755406, 1 }

  8. 6

    {9,3,32,17,34,35,7,16,16,35,47,39,9,47,24,22,29,21,36,32,36,29,7,18,16,32,2,43,10,21,11,29,11,23,9,34,11,18,26,44,26,37,16,43,42,5,20,43,19,26}

    {5291810,2425670,7955662,6289367,8774471,8173213,2073833,2991876,6205014,526137,9380221,1684151,3490331,4886112,1057064,6613993,5568075,8401953,5634696,9445032,9790030,5414411,9482121,7162053,6915428,4136225,1867278,2578224,5810004,2071543,8278797,9566417,2106157,5559495,7506128,1813685,6668793,5406572,8468552,9627729,5507885,113359,5719949,8185650,4829897,8132146,3208637,4092508,7100422,903089}

    Returns: {107574186, 1 }

  9. 1

    {6,17,18,16,11,31,30,3,32,49,29,50,50,30,20,6,23,8,2,21,10,46,48,49,22,6,41,16,38,43,15,1,8,25,1,47,20,29,21,5,14,33,25,26,10,24,18,43,6,37}

    {5043363,564197,8548401,7346364,7791503,4778680,5819992,4941583,3111428,5286130,7526281,9925372,524653,136077,9770921,8920575,5337920,9752269,4973214,8993622,2826177,3983999,3957982,4479351,3919910,6220799,6626153,1535704,4271674,1569036,617633,2271489,4802281,6454597,9500252,1585689,3642836,6243591,3087156,4071343,9706694,6573982,3535567,9662614,9637885,4729250,9319403,6955901,3213900,6830052}

    Returns: {19696293, 1 }

  10. 22

    {50,19,8,2,40,34,28,31,32,23,13,48,32,18,5,29,49,15,47,38,11,2,29,50,32,50,38,9,17,4,12,2,20,35,7,16,1,40,5,46,23,32,28,31,24,30,22,12,12,48}

    {3314084,5826661,549017,8534312,1627056,1561906,2444584,3714414,9029797,9053824,364084,871677,6336561,2300418,7309052,1631039,3238131,9869129,1600545,2630338,8345880,3605447,3040395,8297999,349793,1624941,6730367,3692957,927935,7462399,8571459,6790435,1201387,6369963,4366679,947610,8373381,3839775,9662998,7380194,8618502,9408387,5229184,7415582,3709863,9667931,4464341,3500426,9834631,4784389}

    Returns: {246011743, 1 }

  11. 25

    {50,7,6,14,39,37,22,7,45,3,35,39,34,31,16,17,11,15,25,9,11,50,40,25,32,28,31,33,50,31,2,23,17,17,2,19,12,19,46,34,8,18,37,40,3,41,20,6,47,29}

    {1713904,135022,4268298,5065098,6991038,2098504,5732011,7258970,1255185,1214499,1951569,7482461,6009649,2874029,165363,51974,3682542,556419,2583601,9018370,478552,9457792,5140007,5520660,2609725,265679,6263408,4138974,2297503,1150792,5751589,6102566,8431252,9827939,8062279,6229096,3431434,9649851,7028026,5211634,1811796,6875570,7533075,1177911,415226,7961035,4520441,2118766,1506497,481663}

    Returns: {211559244, 1 }

  12. 16

    {34,28,20,26,37,31,30,3,48,15,42,24,7,21,23,47,19,16,26,39,16,22,37,29,8,23,29,30,38,21,11,44,50,22,13,8,44,25,49,37,4,37,6,8,13,50,37,7,16,23}

    {4272585,7975623,2035069,4212527,3918292,1102400,8721787,4267369,7066219,6519686,9701197,4538201,1732330,9684395,9366671,5255080,7084669,6057470,2668300,9748921,7035252,5433708,9254800,4528678,3921310,4680422,8211606,4868248,2817772,3238955,3598152,4277260,1864962,8196102,6396908,7413322,7731443,7144829,1286807,584025,2790059,816194,80874,3594725,8955327,728998,167929,3362423,7487720,4448425}

    Returns: {214457760, 1 }

  13. 14

    {4,2,26,6,34,4,23,45,7,6,41,32,12,41,37,24,42,2,44,11,13,23,9,39,45,42,41,20,12,29,29,47,48,34,7,21,16,46,14,32,15,23,35,37,24,22,38,10,48,20}

    {7222198,7264806,9341799,1741953,3261187,5276446,834018,1296796,7451971,3040818,7658049,2901689,3219763,4724337,8860914,3727153,3577069,7948808,2457405,3987404,5963340,2154967,2980962,869021,5385486,9385035,1623674,431488,8668420,2253608,1827834,4033472,380063,4995098,3102191,6271132,5137310,2619237,5050129,4403320,1909940,5296706,2108369,2567012,6170618,2865439,6804032,4998989,7225957,7400044}

    Returns: {174230042, 1 }

  14. 22

    {37,19,25,19,34,44,5,13,6,5,6,1,32,40,44,5,30,43,39,6,20,43,36,26,4,7,17,20,39,31,23,24,13,21,6,3,6,27,33,12,48,47,33,44,17,28,25,38,43,43}

    {5490593,9404605,5300550,3194378,5486233,3127164,8717258,86176,8381545,7350397,8771259,8918297,4060902,5278350,3042671,6544764,9021385,708797,8584085,9960006,341213,982333,3927843,8837279,8772811,4893657,5740456,7879759,2145990,4218431,3866914,3375329,644670,6225230,4213189,842052,9779211,9170682,4936842,2002033,1021770,5031362,7084517,8063393,476668,1229844,5410550,463453,4095841,9088910}

    Returns: {253470670, 1 }

  15. 9

    {29,26,13,29,14,20,8,1,32,16,44,39,39,4,18,23,24,25,24,29,16,42,36,23,44,38,45,13,44,18,21,23,12,1,20,19,38,10,7,25,48,29,10,46,25,37,32,34,4,6}

    {138794,5394803,3874522,7099110,383407,7788474,9477635,3720635,842611,246922,9841403,9378092,6565434,7436970,806439,5960095,8911624,9355700,9339693,3971093,9150231,9011551,598384,2764760,4925334,9885339,4334937,4638889,7360262,730990,8742193,5994089,6114315,9130297,2558809,1997979,744532,1032145,98309,859220,876818,2039929,377840,9036227,6235535,1050682,7148379,6347202,3265313,2448312}

    Returns: {154658614, 1 }

  16. 17

    {20,16,33,45,5,14,16,14,31,26,12,49,18,12,30,35,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

    {9204419,5949645,5673674,8542769,598155,1367457,1714831,3299731,9766427,8274414,2817741,2102907,8358454,9039879,6667152,381249,3527827,733882,767296,4950111,4126824,3759817,7177383,9052363,5757659,4814237,155120,910412,4619887,249150,4121118,1619846,2590195,2412060,9515781,4976884,501607,4033748,8118870,815227,7427070,2303687,4736127,5938912,1301954,6824571,8403125,5991018,675666,6310087}

    Returns: { }

  17. 9

    {17,35,24,31,32,14,23,47,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23}

    {5653103,1129402,4806440,7600659,7313648,2159111,5635096,4304457,2441262,605100,8100428,4265195,7067351,2164532,7823325,1373596,6016470,191465,2658159,633785,6397788,376950,5058181,2088239,7661765,1296593,8577022,1743941,8540453,9196773,4326290,1129292,9645391,4988819,270400,7473558,6257400,6501754,2507635,3277769,4971399,8668210,4632151,974291,1304899,1191219,2934266,5266751,9937837,6433701}

    Returns: { }

  18. 16

    {12,17,12,33,40,40,38,1,39,4,34,34,29,36,5,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41}

    {9923923,2132595,6275686,4253227,4310065,7183865,8588357,8388319,2487023,7554434,4449460,6505165,7734328,3633789,2817438,6157063,4068591,9972663,1361888,411404,8449822,6360670,6104887,2473452,1453170,8414201,8764498,7875518,686902,3341158,7495466,1769001,4754521,9909800,609057,9570259,4084230,9152526,8756532,3833377,2979365,583532,8049812,8066534,9019036,992481,3569348,5419503,8796944,3710532}

    Returns: { }

  19. 7

    {3,35,22,37,39,25,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}

    {7367752,3186379,8397997,6431018,1526924,2883011,4356114,5608260,4550376,6597774,7159664,8359671,9567524,5211953,4645237,7321362,4155679,8800248,9349345,4201149,8984797,7547977,6700696,7288687,7628579,8613305,2481050,9088392,5970453,7243166,4378774,9652656,2412833,6836623,8245434,8461091,557564,1128359,5886514,5959868,4846150,5720780,9219722,9137933,4381243,255562,3545067,8017873,613369,7858234}

    Returns: { }

  20. 7

    {9,45,3,37,47,50,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33}

    {6831484,3106091,5975608,623601,7948033,1211024,6511393,1168550,341221,471816,2341345,1331897,1041018,4172050,8498631,7080189,9731891,8531290,7134850,5451718,8151861,9956650,4488293,8921618,1859494,4420391,9963642,8499806,6645928,7594013,909717,2577732,7295381,1728117,3119317,8546782,8843327,8682560,4283686,1209146,4613996,6702697,3308394,7471511,8651748,5576873,2476257,3393856,5389388,5343136}

    Returns: { }

  21. 11

    {49,43,35,12,15,34,47,44,21,15,3,28,4,9,43,20,49,50,38,12,22,39,16,49,9,45,42,24,10,1,9,25,13,29,19,15,29,20,46,43,45,27,30,27,46,23,20,2,10,7}

    {183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629,183629}

    Returns: {4039838, 814643357 }

  22. 6

    {19,7,14,10,8,37,39,9,28,30,8,28,2,27,50,23,8,40,11,50,21,4,19,43,43,39,4,41,31,23,4,47,6,36,37,15,10,19,5,24,14,46,4,39,16,50,16,20,10,4}

    {7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284,7631284}

    Returns: {91575408, 399650253 }

  23. 5

    {40,21,16,33,9,13,21,4,28,12,42,37,4,11,4,16,6,2,45,21,48,35,23,46,17,28,6,30,30,7,47,22,11,50,42,40,23,28,4,43,44,20,39,25,23,26,24,45,11,30}

    {7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436,7840436}

    Returns: {78404360, 272278100 }

  24. 15

    {5,37,43,50,41,17,9,3,41,12,8,31,28,11,29,32,29,3,22,45,29,21,33,35,16,4,16,32,40,5,31,14,17,27,38,33,45,42,48,7,27,19,44,18,27,7,48,38,16,12}

    {8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426,8240426}

    Returns: {247212780, 211914057 }

  25. 14

    {4,23,10,31,40,50,23,14,41,6,29,40,23,11,42,37,13,47,46,2,28,23,30,18,33,20,3,30,8,11,46,41,36,8,36,43,19,25,4,6,12,6,47,13,6,37,19,42,10,25}

    {3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449,3646449}

    Returns: {102100572, 814643357 }

  26. 10

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

    {3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,175032,3941775,3941775,3941775,3941775,3941775,3941775,3941775,9048334,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,3941775,6464337,3941775,3941775,3941775,3941775,3864605,2327508,3941775,3941775,3941775,3941775}

    Returns: {86464621, 804874000 }

  27. 14

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

    {1288600,1288600,1658688,1288600,3033451,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,8256241,1288600,1288600,1288600,1288600,1288600,1288600,1288600,629645,4064824,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600,1288600}

    Returns: {47939604, 223936873 }

  28. 2

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

    {8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8182096,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,8388967,6556521,8388967,8388967,8388967,8388967,8388967,8388967,8388967}

    Returns: {33555868, 132846 }

  29. 13

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

    {3182695,2105394,2105394,2105394,2105394,2105394,2105394,9697607,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,1921043,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,2105394,7479644,8886365}

    Returns: {75564979, 566427330 }

  30. 7

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

    {6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,7840509,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,3735036,6097079,6097079,6097079,3450312,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079,5465203,351241,6097079,6097079,6097079,6097079,6097079,6097079,6097079,6097079}

    Returns: {87102536, 837717027 }

  31. 21

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

    {1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,55454,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,5092272,4890798,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,1517573,5873686,1517573,1517573,1517573,7493988}

    Returns: {81018518, 45379620 }

  32. 11

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

    {2276616,2276616,2276616,2276616,3547829,2276616,2276616,2276616,2276616,2276616,2276616,2276616,6093346,4221816,2276616,2276616,2276616,9726037,2276616,2276616,6964973,2276616,2276616,2276616,2276616,4040632,2276616,2276616,24723,75342,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616,2276616}

    Returns: {71020489, 509720440 }

  33. 25

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

    {2771140,8379601,2771140,2771140,2771140,2771140,2771140,2771140,2771140,2771140,2771140,2771140,8951850,2771140,2771140,2771140,2771140,2236016,2771140,2771140,2771140,8038050,4646211,2771140,2771140,2771140,2771140,2771140,2053880,2771140,2771140,2771140,2771140,2771140,2771140,2771140,2843347,2771140,2771140,5679040,2771140,2771140,2771140,2771140,2771140,2771140,2771140,2771140,2771140,2771140}

    Returns: {159215875, 1 }

  34. 23

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

    {49283,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,3851164,5856713,5856713,5856713,5856713,5856713,922170,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,5856713,8520396,5856713,819532,430850,5856713,5856713,5856713,2517997,5856713,8932617,5856713,5856713,5856713,5856713,5856713,4470370,5856713,5856713}

    Returns: {268417777, 1 }

  35. 11

    {10,5,13,9,15,23,6,5,2,19,15,4,7,23,6,24,20,15,23,21,2,23,6,2,10,22,6,25,16,4,9,16,8,12,23,17,19,3,21,4,20,4,21,8,2,4,1,2,14,11}

    {734529,734529,734529,734529,734529,734529,734529,734529,7482151,734529,734529,8847975,734529,734529,734529,734529,637148,734529,734529,734529,7998133,1141370,734529,734529,6065895,734529,734529,734529,4894810,9335870,734529,734529,734529,734529,2733103,734529,734529,734529,734529,734529,734529,734529,734529,734529,734529,734529,734529,734529,734529,734529}

    Returns: {58782713, 240152475 }

  36. 1

    {21,1,21,14,23,20,11,22,8,8,12,19,5,16,19,11,7,18,10,7,25,4,1,21,9,1,8,7,8,3,25,8,13,15,9,15,1,24,17,17,20,5,12,18,11,15,16,14,23,23}

    {2444641,2444641,2444641,2444641,4034458,2444641,2444641,1709913,2444641,2444641,2444641,2444641,4752039,2444641,2444641,2444641,2444641,2444641,2444641,2444641,583766,2444641,2444641,2444641,2444641,2444641,2444641,2444641,5559143,2444641,8385896,2444641,2444641,2444641,2444641,690485,2444641,2444641,2444641,2444641,2444641,2444641,2444641,2444641,2444641,2444641,2444641,2444641,2444641,2444641}

    Returns: {13945039, 1 }

  37. 3

    {13,4,7,12,22,25,10,24,5,14,22,22,4,9,16,20,24,9,11,9,17,21,21,15,18,12,8,21,12,1,1,25,16,12,16,6,18,17,23,18,6,25,13,11,2,5,21,20,3,18}

    {8307658,8307658,8307658,8307658,8307658,8307658,6646036,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,92307,8307658,4387611,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,516361,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,8307658,2016342,8307658}

    Returns: {49845948, 8142600 }

  38. 3

    {9,30,37,38,18,10,43,34,4,40,36,20,16,38,33,5,2,38,15,2,15,32,18,10,34,14,3,32,42,36,33,14,12,2,47,12,47,47,41,31,35,29,38,31,19,50,2,6,32,4}

    {8755874,2415823,8755874,8755874,8755874,4876370,8755874,8755874,8755874,8755874,8755874,8755874,8755874,8755874,8755874,8755874,8755874,8755874,52274,8755874,8755874,8755874,8755874,8755874,8755874,3185824,8755874,8755874,6926190,8755874,8755874,8755874,8755874,7898379,8755874,8755874,8755874,8755874,8368470,8755874,8673345,8755874,8755874,8755874,8755874,8755874,8755874,5477772,8755874,8755874}

    Returns: {52535244, 4495722 }

  39. 10

    {36,6,49,29,46,6,34,49,40,2,13,30,47,7,45,22,13,43,24,20,31,16,29,12,4,12,43,27,42,21,12,33,32,42,7,12,12,40,1,21,1,13,10,10,11,38,16,43,26,7}

    {4988945,4988945,4988945,4988945,4988945,4988945,4988945,9917005,4988945,4988945,4988945,4988945,4988945,4988945,4988945,4988945,4988945,4988945,4988945,4988945,139436,4988945,4988945,4988945,4988945,4561119,4988945,4988945,4988945,4988945,6665010,4988945,4969663,54074,4581926,4988945,4988945,4988945,4988945,4988945,4988945,4988945,4988945,4988945,4988945,9980324,4988945,4988945,4988945,4988945}

    Returns: {111374404, 661925378 }

  40. 7

    {18,41,10,19,48,12,4,29,46,38,1,32,50,28,25,23,42,43,2,49,11,33,49,22,12,35,2,23,1,38,23,33,33,4,35,48,32,11,34,42,47,1,44,15,43,45,30,7,43,2}

    {4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,6156514,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,4227735,6822361,4227735,4227735,4227735,4227735,4227735,4227735,4966862,9571833,4227735,2280041,4227735,4227735,3296797}

    Returns: {69794920, 481256764 }

  41. 9

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

    {9295268,193620,202534,9815847,7992537,7154709,7870366,6066986,105400,7638794,8918217,5445658,6353484,9919115,1113618,5074093,1824977,3519486,8890556,7372337,5813088,7857601,1418680,4710802,5916154,8525226,6554814,2184175,464724,8991821,5982303,8894743,9549636,861195,9389109,2978346,8041983,5021828,7978754,2566592,6005430,5141933,5817470,8366323,5487338,7146470,8993077,5314036,3858502,2044832}

    Returns: {156928973, 1 }

  42. 24

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

    {1483075,9195630,995266,6423643,8196022,1899903,7803577,3460888,1504854,2214779,9841638,9158138,6935034,6144206,74510,4895798,7883178,9355119,8671074,4356252,3598982,7139754,110003,9618805,8965161,4046912,6978554,428108,8074289,975917,6407381,5801096,2013609,9727744,8897977,3457470,7241269,3229414,8948238,2326643,8373010,7793712,4779621,8823455,644071,1615998,5813472,9002326,7798006,7071828}

    Returns: {280010896, 1 }

  43. 25

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

    {6148973,8529370,7084828,1501814,2540137,9906878,3932713,8515127,2744038,4305080,3175471,7782697,6603330,6268559,5819659,7613778,7833561,1819337,9616783,7341615,9519807,7525591,6595710,575335,7147627,2444599,143303,7180531,5564259,8968460,6822278,6988036,532511,7234039,5607563,1866010,7888612,9542822,3450791,2324934,1820079,7552803,2666220,1590335,3192008,5835945,9802220,8989779,5656360,8212798}

    Returns: {282325113, 1 }

  44. 5

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

    {4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,9497872,4536492,9921954,4536492,4536492,4536492,4536492,9977126,9875570,4536492,4536492,4536492,9626447,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492,4536492}

    Returns: {71581429, 1221752 }

  45. 17

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

    {5081662,5081662,5081662,5081662,5081662,5081662,9964721,5081662,5081662,5081662,5081662,5081662,9148351,5081662,9737570,9304885,9601798,5081662,5081662,5081662,9779875,9392566,9894707,5081662,5081662,9840403,5081662,5081662,5081662,5081662,5081662,9737251,5081662,5081662,5081662,5081662,5081662,9628918,5081662,5081662,5081662,9245976,9750259,5081662,5081662,5081662,5081662,5081662,5081662,9756715}

    Returns: {236417235, 307872061 }

  46. 15

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

    {2667269,9493704,9202104,9132348,2667269,2667269,2667269,2667269,9045242,9497716,2667269,9548091,2667269,2667269,2667269,2667269,2667269,2667269,9217356,2667269,9179417,2667269,2667269,2667269,2667269,9307488,2667269,2667269,9940186,2667269,2667269,2667269,2667269,2667269,2667269,2667269,2667269,9821882,9351924,2667269,2667269,9610151,2667269,9109956,2667269,2667269,9175556,2667269,2667269,2667269}

    Returns: {180642156, 247943139 }

  47. 10

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

    {9119322,5085294,9941512,5085294,5085294,5085294,5085294,5085294,5085294,5085294,5085294,5085294,5085294,5085294,5085294,5085294,9520962,5085294,9486419,5085294,5085294,5085294,9509174,5085294,9644550,5085294,5085294,5085294,5085294,9135939,5085294,5085294,5085294,5085294,5085294,5085294,5085294,9162873,5085294,5085294,5085294,5085294,5085294,9082406,5085294,9242110,5085294,5085294,5085294,5085294}

    Returns: {144698207, 847660528 }

  48. 8

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

    {1650363,1650363,1650363,1650363,1650363,1650363,1650363,1650363,1650363,1650363,9174100,1650363,1650363,1650363,1650363,1650363,9114696,1650363,1650363,1650363,1650363,1650363,9808039,1650363,1650363,1650363,9344713,9574792,1650363,1650363,1650363,1650363,1650363,1650363,9580390,1650363,1650363,1650363,9621825,9174477,1650363,1650363,1650363,1650363,1650363,1650363,1650363,1650363,1650363,1650363}

    Returns: {88595936, 118030185 }

  49. 5

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

    {4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,9355443,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,9240837,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,9702702,4271419,4271419,4271419,4271419,4271419,4271419,4271419,4271419,9733249,4271419,9433157,4271419,4271419,4271419,4271419,4271419}

    Returns: {68822483, 1221758 }

  50. 17

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

    {6576404,6576404,9292252,6576404,9140764,6576404,6576404,6576404,6576404,6576404,9611475,6576404,6576404,6576404,6576404,9213684,6576404,6576404,6576404,6576404,6576404,9760970,6576404,6576404,6576404,6576404,6576404,6576404,6576404,9269388,9202158,9594437,6576404,6576404,6576404,9414366,6576404,9522527,6576404,9759497,6576404,6576404,6576404,6576404,6576404,9578503,6576404,6576404,9639902,6576404}

    Returns: {261104407, 875774586 }

  51. 1

    {1, 1, 1, 1, 2, 2, 2, 2 }

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

    Returns: {2, 16 }

  52. 15

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

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

    Returns: {80, 352716 }

  53. 1

    {1, 2, 3, 3 }

    {1, 1, 2, 2 }

    Returns: {3, 4 }


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: