Statistics

Problem Statement for "WaitingForBus"

Problem Statement

The bus station in Joseph's town operates randomly. Before the bus station opens, there are N buses at the station. The buses are numbered 0 through N-1. Whenever a bus has to depart the station, one of these buses is chosen at random. Different buses may be chosen with different probabilities. More precisely, for each i, the probability that bus i will be chosen is prob[i]/100. After bus i departs the station, it follows its specific route. The time the bus needs to complete its route is time[i].

The bus station opens at time 0. At that time, the first random bus will depart. During the day, as soon as a bus returns from its route, a new bus is randomly chosen to depart in that same moment. (The probability distribution is the same for each random choice, and the random choices are mutually independent. It is possible that the bus chosen to depart will again be the bus that just arrived.)

Joseph just arrived to the bus station. The current time is s. He is going to wait for the next bus. (If there is a bus departing precisely at the time s, Joseph can still catch it. In this case, his waiting time is zero.)

You are given the int[]s time and prob, and the int s. Return Joseph's expected waiting time.

Definition

Class:
WaitingForBus
Method:
whenWillBusArrive
Parameters:
int[], int[], int
Returns:
double
Method signature:
double whenWillBusArrive(int[] time, int[] prob, int s)
(be sure your method is public)

Notes

  • Your return value must have an absolute or relative error smaller than 1e-6

Constraints

  • time will contain between 1 and 100 elements, inclusive.
  • prob will contain the same number of elements as time
  • Each element of time will be between 1 and 10^5, inclusive.
  • Each element of prob will be between 1 and 100, inclusive.
  • The sum of all elements of prob will be exactly 100.
  • s will be between 0 and 10^5, inclusive.

Examples

  1. {5,100}

    {90,10}

    5

    Returns: 9.5

    Joseph will arrive to the bus station at time 5. At time 0, one of the two buses was chosen. With probability 90% it was bus 0. This bus will return to the station at time 5. Therefore, a new bus will be chosen to depart at time 5 and Joseph can board it immediately. With probability 10% the bus that departed the station at time 0 was bus 1. If this was the case, the next bus will depart the station at time 100, which means that Joseph's waiting time will be 95. Thus, the expected waiting time is 0.9 * 0 + 0.1 * 95 = 9.5.

  2. {5}

    {100}

    101

    Returns: 4.0

  3. {5,10}

    {50,50}

    88888

    Returns: 3.666666666666667

  4. {1,2,3,4}

    {10,20,30,40}

    1000

    Returns: 1.166666666666667

  5. {10,100,1000,10000,100000}

    {90,4,3,2,1}

    100000

    Returns: 21148.147303578935

  6. {136,1,14,8991,6252,9,88,2,455,5410,9,2,246,2137,814,4749,2,12130,6,936,5,7,94478,250,61236}

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

    86991

    Returns: 29156.080240871986

  7. {31842,276,157,30,23,1,5,1906,227,20062,17652,32,5,89051}

    {6,8,7,10,10,8,8,10,3,7,5,8,3,7}

    14753

    Returns: 27923.782623461444

  8. {1,140,1071,1,414,79,32462,122,238,33,5567,1,92487,8,2,3,45,15,1218,22,51437,8437,20,651}

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

    64105

    Returns: 26031.47054286244

  9. {713,1868,175,374,16,70879,21874,2,35087,676,7,34414,2548,89059,21,1846,4,181,399,3,3,19,19211,50985,61,62510,679,55,2255,2056,8,274,131,12,57141,51039,40023,164,38695,6896,63764,7053,356,3032,1123,59,368,38065,5,22641,4225,12,3,24014,14,4,47014,2,4,4,5,44,8005,4581,147,42721,2,9,1688,1,5,33199,5117,7,925}

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

    41388

    Returns: 22774.047745476113

  10. {7,1764,10701,1,10,290,582,258,1,227,2366,42943,5387,8,231,17,860,811,5496,4358,5663,6683,84,38291,506,55,22,1,8759,175,1,39905,15,18663,6,21,24,83932,23936,67122,15,6814,278,93,364,1990,126,2595,22,2715,1,4628,2,200,207,16,4054,28123,14892,15,1,181,8,1,10,2193,269,29375,313,2842,3395,34519,1,3578,8,748,28496,16,20094,32,219,11,117,7,7,4,5115,1077}

    {2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,2,2,1,1,1,1,1,1,1,2,1,3,2,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,2,1,1}

    19440

    Returns: 20219.593281668152

  11. {48909,249,51,8893,557,20409,51,1,9,99,6,16967,19,53,1,61933,14,8750,11,50,6611,2,306,20554,6,8,1,3895,37,13770,155,55,2403,1505,6206,2331,1261,11,93,45,23593,41,12533,90710,17665,34524}

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

    62342

    Returns: 19409.115066055037

  12. {988,12,5,267,47,10,158,7504,3253,26,198,18,864,1,26,415,30218}

    {7,4,2,3,9,9,7,5,4,9,4,8,4,8,8,5,4}

    819

    Returns: 6420.621280469503

  13. {55,25709,57,9,1001,1081,1052,4004,12567,31,41,338,1,722,14,11,4236,6,204,1468,1,43,4,175,61127,15,3072,25469,62846,259,2,5491,2029,229,132,7823,19123,14466,10800,1,9,2265,49,818,223,2,10,1,3,10689,1,10,20043,2,8,8,226,242,1,4,361,287,15,13,29,20,1,4,13527,55,40089,20,799,65040,9002,43220,64514,82192,21394,15343,195,1,87,28522,13,606,2,8790,322,343,15685,2488,400,15024,215}

    {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,2,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,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,2,1,1,1,1,1}

    50268

    Returns: 22253.809045164526

  14. {6,33,697,37388,6,1,452,25,5450,17000}

    {9,6,8,5,9,9,11,17,13,13}

    63767

    Returns: 11891.855547338813

  15. {13,17118,463,5010,1,154,1,40059,484,744,8189,3,410,2,89266,201,85,7503,849,91633,244,1,2,1250,1,9,11140,39,18536,14,24,150,2,55,247,23696,34,39737,7523,30116,2991,3,700,6290,23146,1010,21,1043,8,319,37,326,70338,1,16292,17318,47598,33453,40,16526,595,32,64615,5,16,73,1,63,611,11922,2,532,69868,12674,25,80,34994,301,79277,56,841,312,2}

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

    8153

    Returns: 28116.786792223054

  16. {24804,2783,47792,4676,12618,99668,83927,33920,14411,95756,34518,3400,15,6045,2107,85401,2394,5685,7312,30858,19243,90365,23346,71479,50779,80062,47528,12253,20842,44639,48871,34607,2117,63694,30031,9695,2427,71571,264,26182,44944,34287,15478,62857,3253,19398,50861,53482,36392,7038,34589,81067,55092,96964,109,8844,63403,32115,1848,38}

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

    64741

    Returns: 30927.62171311761

  17. {3131,945,14498,60977,87095}

    {17,17,19,24,23}

    96270

    Returns: 41416.04785710433

  18. {1208,57,14147,6545,13435,81167,7675,8575,30666,65504,7070,88102,41248,22964,53345,9921,64676,31902,6500,59909,63697,4728,96116,23735,1,79978,40677,64,36780,2016,73664,5017,770,92393,26,1780,454,57491,9162,16056,62523,67239,89362,98460,1,50569,24204,60269,55507,96940,73552,1296,38801}

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

    61381

    Returns: 30009.205158519217

  19. {2154,16640,94886,423,89247,77784,61558,7404,6403,2507,19409,93233,43207,4378,22171,38793,116,63124,23359,37570,22025,16071,46704,7721,83653,43,78173,72149,98173,2547,35719,2846,28193,56071,56718,73217,18424,93279,67454,62083,1229,9697,41252,24176,22206,46403,256,10345,19809,33856,22295,1265,21409,801,66,10338,85494,39042,9357,30302,23452,1645,89268,53715,13440,57682,6554,4241,2891,66446}

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

    85695

    Returns: 28964.327135543914

  20. {81232,486,3305,94765,3771,95015,4491,84898,2838,7859,82449,12177,23603,43820,6931,68,61422,71223,93323}

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

    20067

    Returns: 52259.082173972325

  21. {51283,1913,33924,54372,21249,57602,92970,150,9450,83957,28906,3518,58575,33436,74455,50102,2635,61017,49275,86989,95400,66905,2202,37846,23162,41817,77329,65821,65678,29416,13998,347,35473,81204,5788,42544,1611,33,13658,1340,35352,37163,24854,67101,11435}

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

    79519

    Returns: 29667.0129308522

  22. {13193,68611,33968,383,19428,70770,11422,84977,86465,77560,16508,6503,46293,18794,84777,10545,34743,24349,37366,15668,53704,58656,8010,21740,88045,91221,6541,10416,21651,79823,38650,631,61621,10741,27327,300,425,58625,60079,32304,73266,81437,566,1,41484,63617,50556,5905,16023,2343,2898,25031}

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

    75543

    Returns: 26920.58729092608

  23. {30830,15896,46927,40861,21500,90945,2440,36877,61933,45068,1161,17842,35519,1022,13267,4446,13,61348,232,82939,17512,23068,15210,21220,12492,21398,2212,2785,83398,62205,48257,1227,17023,99864,35972,10816,45285,2304,96505,80384,58330,43937,10076,95339,5676,99554,30143,12603,81998,71831,2351,96976,92807,470,71937,32695,77452,10580,94911,9398,57426,508,3372,17719,130,5475,92696}

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

    37342

    Returns: 37418.062288894645

  24. {39736,7143,7046,480,919,2707,37723,35945,94901,21427,53715,25878,379,60491,52968,2110,42174,59451,223,51802,55961,74906,38278,28894,8755,191,48595,4043,15481,45536,91583,8624,7847,21052,29996,12166,52134,6972,64258,5261,51389,70406,132,15504,87757,1656,17954,82785,1673,3807,4456,24280,60019,30496,45984,8311,43350,330,703,36302,43546,13975,27047,8124,96175,17203,52,23,5726,1295,26578,9728,11969,10535,2417,47002,70010,42055,19549,99045,15518,26286,1,52545,37200,76738,10807,36170,43613,27877,68566,48555}

    {1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1,2,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,2,2,1,1,1,1,1,1}

    88042

    Returns: 26895.61775171112

  25. {47881,36433,75395,89670,2495,34377,33001,78147,46398,5317,27529,65202,163,182,1871,2528,75157,33101,53450,2806,11686,6194,10479,50987,9763,73716,19517,35249,19734,82224,81673,43291,55887,94265,24320,7997,10125,17639,52024,1022,17010,85865,17729,92627,180,14920,55497,40719,1464,268,6187,77145,65733,84537,1832,189,2015,43548,16463,46849,2209,46231,38136,1518,55482,4813,3531,9153,9805,55174,48107,82970,25878,7124,17524,449,953,46517,23043,42680,54952,32492,4898}

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

    66881

    Returns: 28032.241620204524

  26. {8990,14526,92133,94958,15718,7457,16830,76565,44296,8615,74026,57068,21713,14207,40014,39977,80364,12935,20382,90847,98641,39372,3245,80436,49640,20530,78329,254,53142,6243,45651,65389,27767,98333,40780,7891,69896,70919,85008,55482,43946,4832,28240,85009,54556,42790,89978,37803,85445,8769,19554,84970,31962,24993,90546,34676,24773,3005,16348,80584,40653,81474,23911,884,23029,32712,50932,30700,89681,62330,38095}

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

    1232

    Returns: 45549.386420707444

  27. {89983,11813,92646,3851,90504,68327,97681,57818,58850,53286,31784,24954,9190,91853,88657,51562,59980,49871,41074,78319,54024,58046,15178,12257,92617,82078,12458,76092,25608,612,58403,23397,95545,19370,89704,13651,68546,19473,52950,99908,97147,10712,76898,93649,51085,36383,97687,36286,20828,55353,61786,24918,45645,9092,4997,11050,43089,66721,7474,15378,20005,29452,54550,79135,26513,67337,91016,3076,73897,55856,42584,8875,74916,77625,92395,94518,80787,55399,42719,45212,82941}

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

    59119

    Returns: 34343.58056483287

  28. {14032,18088,86000,83990,41761,3697,60097,81146,65718,1146,90299,81456,1699,77360,92881,15862,61737,49481,91948,70907,89860,68635,71357,43629,80656,50464,66153,89748,19858,17568,91008,71744,22242,52690,90736,61165,6251,48285,63707,400,37074,78068,52810,83146,90302,9189,20590,69931,36824,19895,25291,15302,26287,86826,92759,46686,51224,58566,35489,1393,6872,37600,4598,97927,22732,51563,73081,90440,31076,6439,39452,31132,54918,79346,9695,44320,43332,26582,62443,98101,55583,53815,27393,44731,97162,19613,10184,89256,40621,20950,78315,37421}

    {1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,3,1,1,1,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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1}

    96603

    Returns: 35799.21698074305

  29. {93568,24162,69439,40965,17860,57204,57743,98807,74276,36035,66069,6625,54449,48569,97435,89111,23849,84523,91995,11428,63838,66295,27455,65798,57231,51670,58863,73205,42311,46307,14536,6953,943}

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

    40390

    Returns: 29279.416890131462

  30. {92909,84253,51370,20008,25997,59801,27316,26148,33460,24806,3304,36570,26459,98735,55893,14201,96266,84452,55390,75443,68634,51449,89183,23974,89980,72643,36617,78526,81774,32507,69778,21069,69940,67394,26484,98947,94639,95076,51916,24766,32430,39853,33506,31219,17604,62021,60079}

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

    66554

    Returns: 30379.899149543067

  31. {63968,90670,69039,48374,33537,94660,18174,33568,98473,14459,31545,56516,48180,50267,6900,59693,41727,71739,17517,65792,41560,54836,60041,22416,36681,99327,88937,84107,66419,69045,45249,34839,81084,82333,89029,78418,78953,68417,74575,1675,40446,97018,65507,45914,39765,83082,72799,5737,51922,66309,12977,11232,88751,66013,26036,39405,91392,15854,63002,43839,78680,90126,51627,87720,984,43513,75338,14735,77243,99632,55362,94724,99333,40170,8873,36603,72324,66038,67006,69706,21817,24767,75770,56555,40269,24179,70184,14984,63044,81438,7333,95613,61919,88675,67619,81870,18867,11638,85117,54064}

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

    96158

    Returns: 36807.41297473289

  32. {47736,86454,50168,39164,15795,26835,45762,84031,43667,41846,15707,30953,53292,98017,75303,99989,651,88526,46270,21543,96710,8693,65871,44651,92859,29432,57409,54097,17556,17201,16387,70732,55653,1431,23025,75878,94789,95975,26272,70310,24297,39818,57056,51062,61194,34105,19233,65214,95136,17472,75554,78777,89620,39757,92933,80950,50255,65326,36394,29273,72569,61598,4313,29572,11637,5774,78897,36097,73675,73348,25332,51892,15840,55668,10626,7174,54578}

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

    89525

    Returns: 32292.624710290078

  33. {3714,19968,53739,27804,89602,75792,24181,70842,2781,91525,5553,5985,64807,4483,28197,32687,63308,73227,77912,37501,73140,7491,80759,57832,88786,4831,86667,74106,68547,68451,3594,7984,487}

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

    86930

    Returns: 36419.46474964056

  34. {52300,99431,36029,31715,78883,74134,45609,66022}

    {14,16,13,12,13,12,8,12}

    85849

    Returns: 37544.13803599999

  35. {55122,12935,36693,10120,78460,43822,4753,41066,89801,82517,38530,9725,10893,57677,80085,55537,33802,38326,44052,22146,79445,84862,75348,21791,24443,84525,92200,72402,89296,6244,63393,37685,74720,13769,39061,43529,4972,83159,52858,40270,87064,80896,40030,29671,23007,72341,70677,77898,18580,46688}

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

    26903

    Returns: 40107.865334747934

  36. {39, 13, 52, 26}

    {15, 25, 35, 25}

    53

    Returns: 27.829531250000002

  37. {10000,10,10000,10}

    {50,30,10,10}

    2

    Returns: 6002.0

  38. {10,10,10,10,10}

    {25,20,15,20,20}

    100

    Returns: 0.0

  39. {5, 100 }

    {90, 10 }

    0

    Returns: 0.0

  40. {5, 100 }

    {90, 10 }

    5

    Returns: 9.5

  41. {10, 100, 1000, 10000, 100000 }

    {90, 4, 3, 2, 1 }

    0

    Returns: 0.0

  42. {10, 100, 1000, 10000, 100000 }

    {90, 4, 3, 2, 1 }

    100000

    Returns: 21148.147303578935

  43. {99999, 99999 }

    {50, 50 }

    100000

    Returns: 99998.0

  44. {99999 }

    {100 }

    0

    Returns: 0.0

  45. {1 }

    {100 }

    0

    Returns: 0.0

  46. {41, 18467, 6334, 26500, 19169, 15724, 11478, 29358, 26962, 24464, 5705, 28145, 23281, 16827, 9961, 491, 2995, 11942, 4827, 5436, 32391, 14604, 3902, 153, 292, 12382, 17421, 18716, 19718, 19895, 5447, 21726, 14771, 11538, 1869, 19912, 25667, 26299, 17035, 9894, 28703, 23811, 31322, 30333, 17673, 4664, 15141, 7711, 28253, 6868, 25547, 27644, 32662, 32757, 20037, 12859, 8723, 9741, 27529, 778, 12316, 3035, 22190, 1842, 288, 30106, 9040, 8942, 19264, 22648, 27446, 23805, 15890, 6729, 24370, 15350, 15006, 31101, 24393, 3548, 19629, 12623, 24084, 19954, 18756, 11840, 4966, 7376, 13931, 26308, 16944, 32439, 24626, 11323, 5537, 21538, 16118, 2082, 22929, 16541 }

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

    100000

    Returns: 10823.310788743831

  47. {1, 1 }

    {10, 90 }

    0

    Returns: 0.0

  48. {99999, 100000 }

    {30, 70 }

    100000

    Returns: 29999.61

  49. {8882, 6599, 287, 9619, 5191, 95, 280, 866, 7248, 1661 }

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

    9578

    Returns: 3659.429367779687

  50. {99999, 99998, 99997, 100000 }

    {33, 33, 33, 1 }

    0

    Returns: 0.0

  51. {100000, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 15, 16, 17, 61, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 }

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

    100000

    Returns: 5035.99971704088

  52. {3 }

    {100 }

    0

    Returns: 0.0

  53. {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, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 }

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

    100000

    Returns: 33.000000000000874


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: