Statistics

Problem Statement for "TwoNumberGroupsEasy"

Problem Statement

A multiset is the same thing as a set, with the difference that a multiset can contain multiple copies of the same element. For example, {1,1,1,2,3} is a multiset that contains three 1s, one 2, and one 3.

The distance between two multisets is the smallest total number of elements we need to erase from them in order to make them equal. For example, the distance between {1,1,2,2,3} and {1,2,2,4} is 3. Note that we can compute distance as follows: For each value, we count its occurrences in the first multiset, we count its occurrences in the second multiset, and we write down the difference between those two counts. The distance is then equal to the sum of all values we wrote down.

If S is a multiset, then (S modulo M) is the multiset of all values (x modulo M) where x belongs to S. For example, if S = {11,12,13,21,22} and M = 10, then (S modulo M) = {1,2,3,1,2} = {1,1,2,2,3}.

You have two multisets called A and B. The first multiset is described by the int[]s A and numA. For each valid i, the multiset contains numA[i] copies of the value A[i]. The second multiset is described by the int[]s B and numB in the same way.

We are now looking for a positive integer M with the following properties: M must be greater than 1, and the distance between (A modulo M) and (B modulo M) must be as small as possible. Compute and return the smallest possible distance.

Definition

Class:
TwoNumberGroupsEasy
Method:
solve
Parameters:
int[], int[], int[], int[]
Returns:
int
Method signature:
int solve(int[] A, int[] numA, int[] B, int[] numB)
(be sure your method is public)

Constraints

  • A and B will each contain between 1 and 10 elements, inclusive.
  • All elements of A will be distinct.
  • All elements of B will be distinct.
  • The number of elements in numA will be the same as the number of elements in A.
  • The number of elements in numB will be the same as the number of elements in B.
  • All elements of A and B will be between 1 and 1,000,000,000, inclusive.
  • All elements of numA and numB will be between 1 and 100,000, inclusive.

Examples

  1. {1,2,3,4}

    {2,1,1,1}

    {5,6,7,8}

    {1,1,1,2}

    Returns: 2

    This input describes the multisets A = {1,1,2,3,4} and B = {5,6,7,8,8}. For M=2, we have (A modulo M) = {0,0,1,1,1} and (B modulo M) = {0,0,0,1,1}. The distance between these two multisets is 2, and that is the best we can get.

  2. {5,7}

    {1,1}

    {12,14}

    {1,1}

    Returns: 0

    The optimal solution is obtained for M = 7.

  3. {100}

    {2}

    {1}

    {1}

    Returns: 1

  4. {1}

    {1}

    {1}

    {1}

    Returns: 0

  5. {5}

    {1}

    {6}

    {1}

    Returns: 2

  6. {733815053,566264976,984867861,989991438,407773802,701974785,599158121,713333928,530987873,702824160}

    {8941,4607,1967,2401,495,7654,7078,4213,5485,1026}

    {878175560,125398919,556001255,570171347,643069772,787443662,166157535,480000834,754757229,101000799}

    {242,6538,7921,2658,1595,3049,655,6945,7350,6915}

    Returns: 7

  7. {430350320,971879724,819555822,618069789,820793969,464877445,107016554,86390274,391108280,540258889}

    {39731,55729,24214,46461,73810,58578,69484,37782,83709,80782}

    {530619812,642378547,778990645,121421934,736416946,703439938,430051618,73608085}

    {20738,52738,3407,96305,35120,28629,23211,43461}

    Returns: 266671

  8. {787635808,69073899,727740364,91961909,561328079,532612994,445705324,375404218,503270512}

    {3630,58876,83548,39129,29619,88527,8672,19437,20163}

    {95641554,546409587,294059736,69790924,59157351,321743230,43283535,547428275,27769200}

    {19178,27512,45074,51527,38853,89907,87753,41611,43708}

    Returns: 93522

  9. {728668149,48864810,853242445,752162484,428192564,342166021,600326538,698564774,441142645}

    {65954,79668,48332,76379,59116,19715,74033,19945,4618}

    {550583671,865303766,730480317,283028704,400637025,500481567,151192227,91534494,142314786,785137776}

    {83567,81038,25933,47410,51843,63201,98008,41625,38996,28125}

    Returns: 111986

  10. {757888320,763845226,122596133,182161576,471135746,235399639,82277586,121052521,242484602}

    {92686,29251,34459,93306,88813,54667,78393,80685,68776}

    {876271620,69505113,518006455,605697837,176578978,113626011,327113793,895301052}

    {28824,4428,80552,71670,81798,18409,25882,46511}

    Returns: 312252

  11. {772182922,648963471,529712153,390335759,938328521,602451949,100171368,448641015,241860610,7911103}

    {91347,33068,82567,36000,10341,75562,64582,1690,17573,93402}

    {724711429,521706142,203878621,332526755,422308158,868214398,365247923,862846710,493748477}

    {59002,41385,8977,43916,66646,97720,27738,24220,58520}

    Returns: 80540

  12. {674009052,978762670,600177702,964330066,610393876,868605999,990293689,819513471}

    {96107,68512,59661,70972,20797,37367,2281,66929}

    {468133842,234258748,516307793,634137385,799755928,241814455,241206237,275986636}

    {69870,15459,55866,77150,45754,20413,17964,19824}

    Returns: 229958

  13. {587038005,501650761,694487815,540490191,526589998,765604401,684581817,190301658,121845131,60550020}

    {67233,94643,38601,15265,32252,93247,10616,34619,34524,73902}

    {244472498,669948944,98623449,900507936,933460275,108216781,312345819,757083640,144011291}

    {92830,27599,20871,8039,28475,11275,89335,1610,29209}

    Returns: 185659

  14. {676184971,612990240,951485011,964797334,754577042,625792873,754831864,179969914,706889248,368620952}

    {96237,16752,65155,20165,86489,20099,74618,90413,63432,67924}

    {593505916,761460825,944271989,216368873,82477342,345317905,472203394,509994408,266665068,739620268}

    {74297,62522,31172,68139,82659,9454,38801,15914,3482,97657}

    Returns: 117187

  15. {791694507,122824641,750470298,295372930,479697745,132292124,870544831,950158024,878186273,101747120}

    {16,81578,33620,7724,29005,25705,96063,81844,7636,38411}

    {247667489,480686775,349080888,385777556,366588604,979538179,199954731,82761558,338368129,636090694}

    {93838,11549,88751,81442,86500,69095,78967,41953,47376,73321}

    Returns: 271190

  16. {751433901,953744896,828313174,224343134,666864484,945351182,723595592,341841231,894255500,276496757}

    {40572,94027,6698,76974,39351,70023,38672,69299,29423,76631}

    {421320704,820017157,810413107,744082597,43185670,682534600,830843861,279290228}

    {82462,79541,63048,23148,74735,77491,69022,54478}

    Returns: 114259

  17. {62458133,490137251,480561369,792548874,901025797,386569541,413385497,44455416}

    {24310,3936,15044,42082,87682,1751,22564,15376}

    {496435796,668958320,744894209,228760968,123841914,802680338,674156137,398998314,851451415}

    {18199,49070,54954,57390,33273,59843,91399,21089,29151}

    Returns: 201623

  18. {16719593,684656759,73242596,933690791,152050942,216269159,740538002,352576191}

    {29390,95700,74013,38914,86919,23901,58780,42612}

    {487168193,23675640,179265817,798067058,753073576,854637793,628031349,781496651,343683754}

    {61221,86552,19108,21151,35426,35280,39078,4358,63614}

    Returns: 84441

  19. {502618598,315107765,403039109,128181493,249145041,838723254,755783539,571017615,482966687,174417375}

    {1219,98772,60578,12325,34976,16873,60263,54825,3726,46166}

    {935114738,86578274,548660706,585998573,680307817,953431420,567825785,585447210,55581146,677655841}

    {68114,84409,14381,63389,42826,88081,56965,79340,98430,83513}

    Returns: 396335

  20. {979654554,554397967,501237950,468906160,877179239,242495473,369741279,950828294,536161185}

    {55217,71170,21483,70867,18396,69971,8478,23064,93503}

    {705162438,33138320,951228598,639355855,802820365,22313737,675024901,498512375}

    {45138,6366,28953,88080,582,74270,56980,86653}

    Returns: 135221

  21. {415246345,593489609,972577819,287599999,947871729,750111487,154594790,912201498,914674999}

    {96228,53224,81553,98403,55814,32367,73730,85919,27749}

    {948050098,746594157,739096675,293531525,328526849,902929274,439610802,145945422,800256050,660072367}

    {80646,28271,56444,74571,17778,80286,58778,61710,85062,27501}

    Returns: 309478

  22. {467930994,122937606,210113425,179108679,438746494,955452331,453810512,827217}

    {719,43570,15573,84943,52154,48419,41842,15430}

    {216921134,80243023,4209213,238551851,864820926,624308934,588645295,999383942,87966505}

    {64475,55452,8943,72014,60730,90101,19695,49724,79004}

    Returns: 197488

  23. {287412769,41792444,860843511,587696855,631110982,289950337,547910738,7064891,90797036}

    {18070,83001,82255,13633,12251,76244,96527,79496,73534}

    {185371396,35287413,878865337,484161746,136312117,138047558,742840496,95929963,682184466}

    {37933,43890,15434,53435,89388,72721,56465,4780,15279}

    Returns: 145686

  24. {404460082,609785549,52326559,256904694,424066579,22087386,404523039,690288971}

    {47393,90824,36351,76369,40877,1659,80828,56135}

    {426437891,265585246,56953200,362059196,781871407,56603127,455312747,861578238,841988783}

    {71692,9468,74322,88226,52895,28384,81535,29407,71895}

    Returns: 77388

  25. {791601693,322329596,155517992,217822138,815525770,443077867,608822646,564207293}

    {53766,45533,11717,45282,81852,27099,39836,93132}

    {765532127,455586809,76682531,876356872,261122289,497412940,272458150,334655629}

    {65525,61894,96126,4643,27985,71335,54058,47227}

    Returns: 161810

  26. {21731061,555171385,515096616,648578482,675412156,398821116,850006749,117379138,246028033,671351932}

    {33171,87293,30040,33091,84640,82044,53506,64752,74643,9859}

    {935949477,869190642,849245491,613507859,631010285,285307206,946889297,490859482,455253547}

    {54578,57075,62873,87771,52135,60506,68328,65320,26332}

    Returns: 224929

  27. {276952853,481738788,960891045,96678953,739152593,884100689,43739672,409311848,605779882,66383049}

    {7106,2492,7447,6618,4140,5517,6555,1003,8159,8106}

    {660431338,531518576,817837807,258357287,364657286,776534055,880558465,7969535,468393846,695159436}

    {5891,6375,8352,1707,1439,3053,9791,9727,8213,2596}

    Returns: 3

  28. {664470315,249061892,733543683,869646886,215819342,343560795,474138452,314403274,753025338,174599135}

    {8488,3069,7166,4613,6713,8622,4817,8094,3405,1691}

    {841866158,38265364,296594700,631736370,402421215,55786722,715262700,24434139,599457425,432454643}

    {1591,2367,12963,6702,6108,7,8479,1430,9662,7360}

    Returns: 13

  29. {1,858081051,819555822,820793969,86390274,430350320,540258889,900834732,984230425,569661457}

    {100000,5,4,4,4,5,2,5,4,3}

    {999999938,106152590,414644115,578774627,748934565,33701630,313607912,439235275,923454630,313959628}

    {100000,4,4,4,2,3,1,1,1,1}

    Returns: 57

  30. {1,255738751,848799598,739311458,518424735,249672384,438448926,361587454,410623764,262608937}

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

    {999999930,316803553,616502766,594716473,708847562,920350576,542828158,754531091,63246023,51951545}

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

    Returns: 61

  31. {1,357587788,158791193,146751449,961677661,874369996,547735991,766929869,555673650,88793795}

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

    {999999894,978694092,717643779,417365954,257648332,84259116,415074033,853404618,865303766,500481567}

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

    Returns: 56

  32. {276952853,481738788,960891045,96678953,739152593,884100689,43739672,409311848,605779882,66383049}

    {7106,2492,7447,6618,4140,5517,6555,1003,8159,8106}

    {660431338,531518576,817837807,258357287,364657286,776534055,880558465,7969535,468393846,695159436}

    {5891,6375,8352,1707,1439,3053,9791,9727,8213,2596}

    Returns: 3

  33. {664470315,249061892,733543683,869646886,215819342,343560795,474138452,314403274,753025338,174599135}

    {8488,3069,7166,4613,6713,8622,4817,8094,3405,1691}

    {841866158,38265364,296594700,631736370,402421215,55786722,715262700,24434139,599457425,432454643}

    {1591,2367,12963,6702,6108,7,8479,1430,9662,7360}

    Returns: 13

  34. {553917978,194029099,624970514,173547763,976471246,281654565,777013746,455602163,458748586,324433113}

    {7907,7795,269,5611,4075,415,2388,9682,7927,3076}

    {729325251,967894887,453090933,813014119,703418373,680061515,548533211,451068800,448698275,206981501}

    {166,6755,7345,6680,5070,5130,6484,1232,1815,8463}

    Returns: 7

  35. {960213181,936658833,970630166,213838350,128538190,1356030,442716178,10093436,596922323,209185929}

    {880,7443,1845,2627,1021,8605,696,5706,7280,5595}

    {373180778,583146079,848039938,441908270,694011894,777465915,417324216,556331802,620930318,262994368}

    {1560,2902,1154,8414,93,4841,2970,7008,4733,8024}

    Returns: 7

  36. {97883421,927023113,579374180,660936714,914573189,879605000,581172816,477731905,85796055,527503143}

    {5098,7311,6826,10178,5199,5115,9576,1365,3401,372}

    {145387603,515539083,192842060,374020122,289758610,323597303,270929002,764314098,200384322,617564217}

    {3744,7623,7884,3704,317,9257,4620,7362,3610,6324}

    Returns: 8

  37. {887333217,717394032,484647368,993129998,817791634,942743174,295808584,392823099,7779758,927407514}

    {8585,8736,87,5724,81,5500,3703,1661,5504,7733}

    {194530092,305666353,803269077,855810344,397746519,584627999,930269098,190415662,895353189,231350914}

    {5214,6285,2037,2263,5724,4744,5025,10069,3180,2766}

    Returns: 7

  38. {540146686,176739043,498330390,917493979,824000594,428472496,619816667,670228329,441141520,665659669}

    {2933,6779,7116,1322,5810,9680,9722,983,3945,1852}

    {133233946,575312585,701665883,211687792,567267664,386419683,602652281,822346765,91044318,123286878}

    {7801,6875,4574,927,7893,2614,4086,9886,3953,1534}

    Returns: 9

  39. {798463063,486879997,176244273,48931906,58041176,415651248,892993637,837808785,588699830,871286424}

    {3940,4889,512,1135,9637,503,9134,2207,9653,7901}

    {139728928,458173803,995131824,191738992,434936325,393955603,129942972,746162161,980278279,867897535}

    {8469,1145,8933,4709,3326,6348,4672,6576,2739,2597}

    Returns: 3

  40. {108552707,260284859,717598493,473904580,175523856,174616118,446816565,268880001,684762162,126876467}

    {2875,9283,2858,7803,3967,8292,9905,4031,6342,1631}

    {436491685,235600085,552656195,49410115,32373006,82041456,637560054,165305159,121758143,148490719}

    {7368,6677,2790,5387,5052,8736,9728,101,10623,525}

    Returns: 6

  41. {123418024,636517959,893914280,465618849,959966096,67297618,132348915,658702322,273328111,829965176}

    {630,9066,9688,4183,3485,4395,3361,1777,4413,2432}

    {868703236,442822635,276186876,760591500,500373758,943354317,378852307,344949378,248600689,943670616}

    {1621,6811,3391,5947,917,2897,9312,6886,3255,2393}

    Returns: 12

  42. {186856306,428260361,685391080,762805793,871075096,70196453,628437095,816620575,580654174,108689333}

    {9460,1741,1505,2381,954,6180,1058,7538,2779,7800}

    {894185333,935618759,877814364,814291771,477019511,624550446,383380237,201501637,529084646,753314354}

    {892,8921,3779,3127,4036,3990,7228,3405,421,5600}

    Returns: 9

  43. {283354813,765902388,595304195,124173806,289106571,522567677,178771389,200685767,394384316,46067640}

    {2634,137,1233,216,8932,3495,5080,4492,8665,8420}

    {144908515,671293754,423351414,391395695,424339548,849101178,205195031,503923804,737672162,964057492}

    {3561,5598,1033,4592,1286,2770,2010,7114,12961,2381}

    Returns: 2

  44. {937975780,862856096,458040479,475568109,406604309,47452967,377334436,370560932,910309336,375088623}

    {3171,5793,7036,3382,3055,2190,1291,7249,5268,9904}

    {862636313,380524568,273512417,828966578,44020000,414423895,18867233,324655938,943462025,846439923}

    {10619,4584,5492,7418,2312,4213,3616,1924,7628,533}

    Returns: 10

  45. {874920965,929133518,315559534,950185996,824678197,233883881,641847532,23672012,929395588,889570378}

    {3399,8810,7210,6678,1086,9373,2772,3567,309,7657}

    {771324035,108032404,591161943,959839680,386400364,712872373,659165555,60317618,598826630,74175551}

    {2180,12572,7544,5209,4758,117,714,8252,7336,2181}

    Returns: 8

  46. {234291100,36884742,450515260,931345502,90842087,782750985,164366522,956852699,438238053,318997484}

    {5332,773,9331,6313,1928,4755,2473,8397,8396,2897}

    {570403847,246103021,40755053,349342475,318848579,210302138,151071197,424757537,531733815,944644755}

    {1873,2703,8679,4909,3808,9140,3813,2058,7128,6484}

    Returns: 4

  47. {30357040,585702048,123814484,541367674,562709207,603317882,374538744,688992210,591894528,543186026}

    {7861,8675,1169,2405,6202,5186,4960,3929,6115,1810}

    {510116315,680611420,944597140,241358104,821394593,248488223,553552788,550265550,281263654,10816205}

    {9526,821,8031,6516,48,5077,5306,6653,4454,1882}

    Returns: 8

  48. {85438601,212585177,415338231,18530451,250151629,438268403,943158458,102478988,846286327,30024282}

    {2748,5732,6636,8650,9182,5207,3061,3736,5227,8356}

    {164283406,107186204,22154630,124125834,899509465,761284739,618455768,948684001,577493166,268683567}

    {477,9865,3907,9528,5174,4727,2335,9121,12018,1384}

    Returns: 5

  49. {167138476,257919702,496699854,417255996,116591093,956557067,365887367,672826879,478941804,453305273}

    {1935,9627,6092,2714,1717,1584,7910,9524,5131,8262}

    {200857729,233180734,757226880,14143454,490453862,56351787,980863366,590720003,53254728,237318654}

    {3805,13599,1207,4502,9060,5936,4861,2286,1905,7331}

    Returns: 12

  50. {924950629,889306023,603127129,348538703,501523408,971344997,615131148,373377248,174060083,180960123}

    {2307,8715,6657,9990,3040,8683,6704,2573,4948,6817}

    {925939744,213776644,98561729,997066172,765292554,245718510,806155909,918234727,352789815,632439105}

    {2115,3421,8518,9519,6203,4136,8292,4790,4007,9432}

    Returns: 9

  51. {150691447,421702189,156650198,617060518,838620229,947056191,998121795,836612893,401377912,167457072}

    {8028,2168,6661,9182,3283,6678,8868,5329,1693,6846}

    {507160865,217098820,833100055,239637529,116604560,409239978,938152632,445054913,397844692,370096926}

    {6729,9298,8493,5836,6592,3569,9695,1098,473,6949}

    Returns: 10

  52. {578328543,24595689,168809077,184051760,504000534,487357204,823075810,202779079,479758225,864525812}

    {4363,211,1516,3989,7380,4191,5354,6957,6276,5735}

    {926472321,57737797,667115496,959990964,676333619,702961145,39890038,517209928,7230924,864118608}

    {2494,2261,4519,7320,3592,7255,3654,702,5430,8739}

    Returns: 10

  53. {349718950,278123744,832233238,835710962,846420656,588504145,87905043,731587016,376825484,13691743}

    {7245,8101,7584,2748,8342,5488,4821,6317,875,2096}

    {404246544,952741431,558593499,934724833,475438549,891997822,914198363,789969039,221816598,429418857}

    {1376,282,8780,7736,7850,3862,7964,7755,210,7804}

    Returns: 10

  54. {19075477,861152440,997996540,186186565,20828300,612547582,80968657,248526655,201913916,614296629}

    {3316,1612,2155,7256,4660,5948,443,4378,9232,8706}

    {189045177,990186615,801316899,202091790,577981776,850631458,809552403,161858725,712752616,714810255}

    {1897,8152,2234,772,2981,9019,4049,3078,6527,8999}

    Returns: 8

  55. {51723578,95250478,707789113,988375888,36959757,864423267,991404225,637138894,241231063,117041705}

    {5881,9295,1869,8635,2546,6499,9429,2385,3360,1783}

    {230793001,582266732,708885399,196796963,483966803,406525915,302231334,821303672,118718501,294759587}

    {8362,5802,7388,3333,3780,4279,7141,2062,1054,8484}

    Returns: 7

  56. {583017691,128977655,496206942,274947931,448527531,281971583,108899108,608531490,311249713,690091995}

    {824,3521,2856,5169,8573,9107,7136,3439,9118,3826}

    {745907565,833744070,806367997,582786555,982226015,444573962,22651003,522888767,118014055,227686779}

    {9311,7176,1713,5850,1593,6374,6281,8699,3246,3328}

    Returns: 6

  57. {333546028,546688858,226937682,979589655,310499,832299255,842128717,747408684,703388343,13694022}

    {1020,9006,465,3423,8222,7001,4507,5744,9556,748}

    {598421677,315657212,196122336,604230798,200591013,740753358,579352371,369983573,503125510,769392333}

    {357,2514,9880,7355,3656,5359,3741,5501,6363,4965}

    Returns: 7

  58. {720978292,34573642,352403700,658774836,939116014,920661435,533058986,284732702,139727309,437482279}

    {8547,4080,9803,6386,50,8751,3019,9994,4415,310}

    {812134222,566213759,12046409,466836110,672116207,364698073,875169547,392865235,651119951,78050807}

    {6135,5164,5603,5543,2718,8466,3292,6993,2147,9293}

    Returns: 11

  59. {861108701,966664432,113855513,17308237,146856306,747600850,471394946,337522757,166593042,532594001}

    {2066,2279,9355,7819,4665,8269,5649,2776,371,1051}

    {877416306,336975828,820273984,155317832,288295032,702628727,974697225,333733411,609591255,36777586}

    {6088,7781,9539,5506,930,3551,3820,3417,2648,1018}

    Returns: 8

  60. {638742945,373048714,536043195,232811832,62094501,688171503,341543012,501991546,188731611,595500325}

    {5002,1843,3024,604,1945,5218,8093,6130,3886,6535}

    {567394389,163171622,50203075,866542893,607391751,931945736,507937259,513882972,880894549,240465891}

    {1252,4063,3044,8281,9730,2664,7169,2713,435,2931}

    Returns: 6

  61. {280055815,552548399,359136410,702696828,244238780,820350990,154339077,584143497,416443666,985109351}

    {1778,3507,2893,2713,7058,1335,8291,9295,1751,7500}

    {469528985,755880327,512509427,705921416,53866441,79480419,760287202,688653132,698573071,387506920}

    {1599,6888,9606,6381,1939,3162,7570,577,12,8384}

    Returns: 11

  62. {95385843,252818721,533497845,866643580,138848282,396327653,513854247,930812840,478332757,57700856}

    {1683,9221,3508,2110,130,3172,7751,5969,2281,7064}

    {759011881,611235308,361902431,8255420,114435108,626967008,1322347,169600196,110761800,754744240}

    {88,6356,1354,1921,9326,5345,976,5659,4379,7485}

    Returns: 8

  63. {113566284,186977467,101966682,880561409,847678114,395611414,99288152,366683128,539755250,733739043}

    {5046,5178,5011,4764,3502,6390,4119,3492,8208,7574}

    {319521701,395611414,982900878,994500480,733739043,28555499,25876969,953972592,554033382,539755250}

    {6916,3315,5392,8167,8270,2697,3041,7557,5555,2371}

    Returns: 11

  64. {25200521,484254404,394211759,598235707,966631826,955277616,399228403,456571956,280230456,348222416}

    {3377,8176,497,6875,223,7563,748,9595,62,7030}

    {484254404,700247681,405565969,354559982,535260391,195204455,348222416,552246364,48524060,802259655}

    {8432,6132,7378,20,3176,6418,375,986,2423,8802}

    Returns: 12

  65. {930597823,65843635,975601122,786472125,971521563,178830224,385496942,25182697,399098330,467081620}

    {4135,551,9707,4169,1065,3332,7363,8399,6601,5801}

    {831475424,241371244,282032182,543224028,961999734,899458714,426157880,327035481,611207318,169308395}

    {1919,5444,8484,259,1482,6303,367,14133,3891,8841}

    Returns: 16

  66. {280083473,624935135,847178785,325219769,507556434,794932819,967358650,440170323,214950738,789703508}

    {1205,5274,4434,7860,4118,5515,1102,9428,6867,1050}

    {220180049,502327123,395034027,899972539,329901292,325219769,392605880,152793938,280083473,797360966}

    {5099,7930,1662,4687,4418,6312,5633,6289,3629,1189}

    Returns: 7

  67. {522886205,400002576,543824344,81049772}

    {12521,8214,7977,16484}

    {522886205,400002576,81049772,543824344,706535539}

    {12520,8214,9475,7976,7011}

    Returns: 4

  68. {206931988,298871857,938374257,620917807,370164885}

    {6092,14433,8592,13199,11429}

    {370164885,620917807,298871857,938374257,206931988}

    {11429,13199,14435,1988,12697}

    Returns: 3

  69. {389272678,730134444,235949023,930737947,796570337,322836785,523440288}

    {9898,9447,13731,9099,3735,9342,6401}

    {796570337,930737947,235949023,730134444,322836785,116142629}

    {13634,5415,13730,9608,9182,10086}

    Returns: 4

  70. {384721132,842643810,859527919,564575846}

    {14263,7569,13341,6881}

    {384721132,842643810,564575846,859527919}

    {14261,7570,6883,13340}

    Returns: 2

  71. {10000019 }

    {1000 }

    {20000038 }

    {1000 }

    Returns: 0

  72. {733815053, 566264976, 984867861, 989991438, 407773802, 701974785, 599158121, 713333928, 530987873, 702824160 }

    {8941, 4607, 1967, 2401, 495, 7654, 7078, 4213, 5485, 1026 }

    {878175560, 125398919, 556001255, 570171347, 643069772, 787443662, 166157535, 480000834, 754757229, 101000799 }

    {242, 6538, 7921, 2658, 1595, 3049, 655, 6945, 7350, 6915 }

    Returns: 7

  73. {1000000000, 999999999, 999999998, 999999997, 999999996, 999999995, 999999994, 999999993, 999999992, 999999991 }

    {100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000 }

    {999999990, 999999989, 999999988, 999999987, 999999986, 999999985, 999999984, 999999983, 999999982, 999999981 }

    {100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 10000 }

    Returns: 90000

  74. {101364623 }

    {1 }

    {10069 }

    {1 }

    Returns: 0

  75. {1 }

    {100000 }

    {1 }

    {100000 }

    Returns: 0

  76. {1000000000, 999999997, 965973963, 482375833, 345675351, 333685941, 192837465, 564738291 }

    {100000, 99999, 99997, 99995, 99993, 99993, 99992, 100000 }

    {999666555, 667779775, 223884995, 338448557, 447557991, 229339449, 118227336, 119337557 }

    {38483, 29384, 100000, 92837, 93847, 99999, 97869, 86859 }

    Returns: 160691

  77. {23 }

    {1 }

    {251536 }

    {1 }

    Returns: 0


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: