Statistics

Problem Statement for "RadarSabotage"

Problem Statement

The final battle between Feudalia and Banania is nearing. Before Feudalian forces reach the Bananian capital, they must cross a well-watched portion of land of dimensions W x H without getting detected by any of the Bananian radars. There are two walls at the left and right sides of the portion of land which you can consider to be infinitely long. One of those walls connects points (0,0) and (0,H) and the other connects points (W,0) and (W,H).

The locations of the radars are given by int[]s radarX and radarY. Each radar i has a power level that is initially set to radarPower[i]. The power level of a radar is a non-negative integer value equal to its power consumption. If the power level of radar i is P, then its detection radius is P*P, which means that the radar can detect any movement within all points with a distance to (radarX[i], radarY[i]) less than or equal to P*P.

The Feudalian force must find a path to take between the bottom and top sides of the rectangle such that none of the points in the path are within the detection radius of any radar. Formally, the path must be a curve that connects two points (x0, 0) and (x1, H) which does not cross either of the two walls, and for every point (x,y) in the path and a radar i, the distance between (x,y) and the radar must be strictly larger than P*P where P is the power level of the radar.

You are a Feudalian spy with the ability to modify the power level of any radar to any non-negative integer value that is not larger than the radar's original power level. Set the power levels in such way that the Feudalian force can cross the rectangle without being detected. If there are multiple ways to do it, minimize the difference in total power consumption between the initial setup and the final setup so that the sabotage is more difficult to notice. Return the minimum difference in power usage that is required to make the land crossable.

Definition

Class:
RadarSabotage
Method:
minimumDifference
Parameters:
int, int, int[], int[], int[]
Returns:
int
Method signature:
int minimumDifference(int W, int H, int[] radarX, int[] radarY, int[] radarPower)
(be sure your method is public)

Constraints

  • W and H will each be between 3 and 1000, inclusive.
  • radarX will contain between 1 and 30 elements, inclusive.
  • radarX, radarY and radarPower will contain the same number of elements.
  • Each element of radarX will be between 1 and W-1, inclusive.
  • Each element of radarY will be between 1 and H-1, inclusive.
  • Each element of radarPower will be between 1 and 200, inclusive.
  • No two radars will be located at the same point.

Examples

  1. 8

    20

    {4}

    {4}

    {10}

    Returns: 9

    There is only one radar initially with a power level of 10. If the power level is changed to 1, the radius of the radar will become 1*1 = 1, and it will be possible to pass. If we only changed the level to 2, the radius would become 4, and it would not be possible to pass:

  2. 3

    5

    {1,1,2}

    {1,2,2}

    {1,1,1}

    Returns: 1

    If we turn the third radar off a path for the army will be possible.

  3. 6

    16

    {1,3,5}

    {8,8,8}

    {2,2,2}

    Returns: 3

    A possible solution is to set the first radar's power level to 0 and the second radar's level to 1.

  4. 51

    4

    {46,8}

    {2,1}

    {8,8}

    Returns: 8

  5. 24

    32

    {3,6,10,18,13}

    {18,23,10,13,26}

    {2,2,2,3,1}

    Returns: 0

    The army is already able to cross without being detected. No change is necessary. Note that the path does not necessarily have to be a straight line:

  6. 20

    30

    {1,1,5,5,15,15,19,19,19}

    {5,10,4,11,3,9,1,8,17}

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

    Returns: 10

  7. 8

    50

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

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

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

    Returns: 30

  8. 50

    49

    {11,42,16,26}

    {6,36,42,33}

    {9,9,3,9}

    Returns: 13

  9. 49

    50

    {39,42,27,11,44,22,29,17,6,16}

    {21,42,14,16,38,27,46,24,30,42}

    {4,9,7,3,1,4,3,9,3,6}

    Returns: 14

  10. 50

    51

    {41,15,47,6,39,19,29,27,10,15}

    {41,30,30,10,42,33,5,36,9,5}

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

    Returns: 8

  11. 51

    48

    {34,35,43,20,43,7,10,7,48,50}

    {17,30,16,34,8,4,28,45,41,20}

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

    Returns: 13

  12. 51

    49

    {38,16,44,20,27,49,28}

    {40,40,41,27,27,30,14}

    {6,9,9,5,5,6,4}

    Returns: 10

  13. 51

    48

    {9,44,10,8,50}

    {15,11,21,6,20}

    {8,4,6,4,7}

    Returns: 9

  14. 48

    48

    {4,3,38,17}

    {47,10,7,11}

    {9,5,4,5}

    Returns: 4

  15. 52

    51

    {49,49,36,15}

    {39,25,14,3}

    {1,1,3,1}

    Returns: 0

  16. 52

    51

    {11,5,7,21,49,5,5,39,41,49}

    {11,7,22,24,19,26,8,1,23,32}

    {7,6,3,1,8,3,9,8,5,9}

    Returns: 23

  17. 50

    51

    {2,28,11,25}

    {15,6,17,28}

    {1,5,8,6}

    Returns: 5

  18. 51

    51

    {10,44,15,17}

    {29,45,12,49}

    {4,9,9,8}

    Returns: 14

  19. 50

    50

    {36,41,42,39,32,21,22}

    {8,16,36,37,17,33,37}

    {1,6,7,8,6,7,2}

    Returns: 7

  20. 52

    49

    {22,2,48,49,33,20,42}

    {41,14,32,13,23,17,41}

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

    Returns: 8

  21. 51

    50

    {41,42,39,6,37,22}

    {35,15,14,39,22,32}

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

    Returns: 9

  22. 52

    48

    {26,37,42,36,3,16,25,32,22,38}

    {31,38,19,9,1,26,12,20,4,35}

    {4,5,9,9,1,2,2,1,7,4}

    Returns: 10

  23. 49

    51

    {5,40,28,7,19,20,42,5,7,11}

    {20,29,29,31,50,50,3,41,20,36}

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

    Returns: 9

  24. 52

    50

    {2,9,5,36}

    {14,27,36,33}

    {3,5,2,6}

    Returns: 3

  25. 52

    48

    {10,32,45,46,10,14}

    {17,2,19,30,47,7}

    {6,4,3,7,3,6}

    Returns: 6

  26. 49

    51

    {12,17,43,14,43,24,35,36,8}

    {32,1,40,49,37,47,18,42,26}

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

    Returns: 13

  27. 51

    49

    {39,25,26,42,15,41,48}

    {43,31,37,18,1,6,16}

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

    Returns: 4

  28. 802

    956

    {307,454,312,454,596,34,305,466,310,706,445,742,312,93,451,512,273,766,191,129,584,71,95,341,311,610,669,662,72,664}

    {602,50,442,532,609,373,38,431,410,659,672,327,521,474,21,750,147,385,550,580,265,390,140,655,413,67,102,763,241,104}

    {141,94,174,73,130,1,30,162,123,38,151,122,86,138,83,144,9,171,129,69,182,8,71,181,104,37,44,98,117,131}

    Returns: 2499

  29. 957

    808

    {770,479,131,225,643,489,881,329,720,92,47,570,434,905,212,12,122,480,176,952,462,554,231,165,603,284,592,944,906,204}

    {633,128,742,435,379,694,759,224,634,338,132,595,4,574,96,123,21,547,53,93,758,670,267,150,775,693,458,265,612,564}

    {116,164,48,119,167,59,174,123,196,41,115,107,125,173,115,159,158,133,54,174,75,45,108,111,70,41,142,91,3,160}

    Returns: 2758

  30. 808

    982

    {682,126,98,361,253,154,438,364,584,50,228,571,126,674,590,795,123,664,79,361,407,331,447,459,494,442,328,28,787,443}

    {912,513,915,556,812,245,942,571,170,845,227,216,887,576,748,972,225,782,901,580,522,503,579,410,674,317,638,175,282,624}

    {81,78,159,41,187,27,54,72,7,105,11,62,198,184,30,151,144,157,33,177,161,170,56,89,52,127,45,159,109,112}

    Returns: 2484

  31. 991

    905

    {957,886,761,543,452,142,32,433,737,137,832,448,533,739,923,696,689,437,289,923,835,819,428,700,718,456,738,763,152,338}

    {341,332,120,436,750,759,606,486,336,252,526,130,802,350,237,172,231,781,735,876,298,405,695,419,524,94,331,717,91,580}

    {172,174,71,56,26,137,56,92,97,177,71,109,13,152,140,52,27,4,137,59,48,96,157,143,135,146,129,142,82,164}

    Returns: 2406

  32. 907

    843

    {121,677,654,504,576,531,356,475,867,54,494,561,795,28,444,285,611,750,804,705,485,463,841,74,127,605,743,425,260,362}

    {438,408,81,383,397,111,513,39,244,486,835,17,282,643,789,555,515,300,483,42,638,11,299,132,359,711,57,779,358,63}

    {6,117,42,71,187,194,56,165,116,41,1,183,34,114,105,99,95,130,199,106,29,161,112,65,123,88,162,139,87,87}

    Returns: 2519

  33. 825

    990

    {42,743,293,227,813,199,13,648,760,587,50,161,271,634,473,186,391,316,480,484,815,529,337,693,704,745,222,93,204,645}

    {268,51,273,92,320,153,428,437,855,66,747,830,482,441,504,817,480,494,161,556,709,498,952,554,314,835,2,480,520,482}

    {68,185,37,187,155,33,154,7,179,3,82,48,10,183,40,15,47,166,40,190,190,175,173,135,159,131,60,49,64,165}

    Returns: 2608

  34. 829

    939

    {749,106,34,809,734,28,28,287,484,745,47,152,716,466,90,312,704,494,97,368,758,622,636,566,323,486,507,460,583,271}

    {479,356,850,643,931,383,750,904,505,143,354,198,691,576,630,412,55,395,415,816,193,523,144,98,332,499,259,894,802,563}

    {27,61,185,135,14,169,10,159,54,88,16,135,190,60,138,15,107,7,50,133,148,66,108,65,100,139,161,66,82,162}

    Returns: 2321

  35. 839

    938

    {721,713,316,212,101,564,656,349,733,327,480,367,402,798,787,164,538,419,473,61,374,363,559,531,687,29,243,612,478,550}

    {759,502,493,478,436,544,17,595,169,129,81,468,492,748,749,799,499,73,698,850,728,498,645,649,455,823,785,925,528,420}

    {9,55,132,63,73,109,49,57,178,53,19,50,80,101,57,134,154,108,175,69,157,179,83,138,86,108,25,186,61,36}

    Returns: 2202

  36. 913

    980

    {681,374,400,280,154,532,454,298,201,775,350,166,306,803,36,435,747,671,105,510,21,825,330,746,466,790,243,714,189,241}

    {303,258,769,442,966,807,339,630,566,85,755,734,379,362,650,877,209,247,539,140,457,836,851,272,454,513,233,341,698,601}

    {172,169,5,195,61,180,71,104,9,148,71,159,21,115,185,155,58,57,184,183,103,16,159,80,118,183,10,117,70,182}

    Returns: 2774

  37. 919

    987

    {555,225,605,664,530,652,572,787,521,219,529,684,444,480,640,525,504,554,350,72,720,431,891,82,853,401,211,550,211,813}

    {170,179,320,949,957,943,377,467,694,311,832,484,81,852,134,508,343,859,322,851,122,394,567,401,857,722,34,741,125,695}

    {47,23,62,106,36,17,59,61,17,26,50,174,96,51,15,182,63,83,178,157,151,173,45,173,69,188,140,1,129,177}

    Returns: 2153

  38. 855

    906

    {351,404,396,709,105,717,793,404,221,725,804,804,288,633,216,549,305,669,63,489,752,207,696,573,359,50,22,770,75,545}

    {232,839,361,436,170,732,19,528,724,168,360,660,851,870,345,890,594,834,771,183,328,47,885,325,213,899,744,835,242,696}

    {130,11,60,162,1,82,97,96,128,110,196,66,107,66,149,125,69,152,39,190,52,61,46,17,159,11,85,61,196,89}

    Returns: 2248

  39. 894

    927

    {222,680,823,314,405,342,884,260,755,149,347,502,500,479,73,511,505,150,531,371,584,801,302,139,414,391,877,436,344,707}

    {830,727,320,202,524,382,753,115,325,104,716,120,755,438,428,703,690,745,751,825,600,17,753,115,595,688,888,406,796,318}

    {162,185,114,174,142,111,169,127,67,14,181,166,42,47,41,114,119,40,70,35,107,23,33,157,95,151,198,14,199,152}

    Returns: 2652

  40. 983

    880

    {388,157,244,138,217,302,977,469,597,787,801,929,373,642,133,166,185,188,390,697,9,557,64,819,558,718,827,791,553,28}

    {427,14,504,239,70,207,762,62,641,284,511,86,851,875,577,425,357,390,285,583,485,587,810,164,221,385,211,594,40,131}

    {97,13,1,35,112,123,5,59,125,104,68,188,40,37,133,117,189,123,135,129,99,142,113,95,187,147,71,48,92,21}

    Returns: 2261

  41. 849

    913

    {410,377,318,675,411,391,670,419,465,640,404,24,319,719,778,378,669,697,103,225,302,373,588,241,591,833,149,494,434,641}

    {711,876,348,62,835,838,245,215,611,850,384,403,590,725,155,553,88,490,625,511,725,793,910,312,396,345,162,622,371,880}

    {6,176,36,171,181,165,199,53,11,19,99,94,113,178,176,153,99,59,98,103,68,17,112,101,56,77,31,51,153,138}

    Returns: 2420

  42. 918

    934

    {350,701,587,607,60,523,18,862,128,816,177,230,619,555,348,768,424,167,700,789,887,499,57,639,241,139,558,610,625,49}

    {644,192,569,33,137,329,33,788,349,604,895,510,773,710,750,103,321,820,234,608,105,26,903,861,912,616,76,310,334,91}

    {192,148,170,31,156,44,120,189,27,92,158,71,167,27,124,31,63,26,40,17,108,87,6,40,69,79,178,18,97,116}

    Returns: 2120

  43. 915

    823

    {82,59,820,273,600,886,2,112,106,479,624,804,770,700,724,517,589,362,273,837,611,645,301,751,123,387,342,338,782,674}

    {670,771,32,230,493,128,149,262,368,254,815,674,722,9,179,808,540,215,305,381,739,98,420,488,312,387,813,119,318,170}

    {4,157,167,20,199,93,113,140,24,25,101,19,127,190,127,71,158,100,27,7,27,7,122,32,6,35,72,99,131,85}

    Returns: 1935

  44. 903

    897

    {330,345,894,239,551,431,368,269,697,35,46,537,494,713,639,301,516,551,221,678,655,370,470,302,863,795,427,136,372,854}

    {21,438,67,513,719,135,115,607,667,497,685,65,805,150,347,818,706,665,38,248,528,512,98,445,154,563,805,195,241,528}

    {10,138,163,112,97,79,159,18,189,144,168,18,37,80,152,51,67,14,58,12,61,164,161,157,165,46,173,26,12,46}

    Returns: 2209

  45. 886

    987

    {467,642,781,798,44,395,766,358,175,475,52,758,206,765,367,524,140,571,867,710,883,764,294,103,610,753,38,140,324,50}

    {104,842,912,545,173,691,356,434,624,542,263,59,799,273,113,509,18,867,150,559,116,625,683,403,725,312,271,981,752,853}

    {50,75,104,88,81,188,187,33,59,43,78,29,98,64,52,19,128,46,38,39,186,9,72,167,52,117,78,72,182,195}

    Returns: 2065

  46. 899

    900

    {404,228,648,364,700,347,532,467,346,189,822,152,736,15,778,50,745,891,73,805,444,463,727,555,351,679,280,697,775,464}

    {505,705,763,273,744,515,730,30,672,249,774,807,484,364,730,201,58,688,854,661,874,510,22,745,86,20,376,120,785,476}

    {182,124,61,109,187,134,144,83,97,133,152,22,193,159,167,122,84,90,122,133,15,182,5,128,32,145,185,44,137,121}

    Returns: 2900

  47. 908

    986

    {838,740,795,551,213,343,558,221,755,872,104,882,422,69,25,305,880,68,792,290,35,272,198,298,179,775,33,375,553,430}

    {640,425,47,639,183,169,438,598,313,515,548,811,655,908,776,641,11,270,507,400,33,775,584,503,649,631,141,434,753,192}

    {18,94,168,78,85,2,25,21,8,44,36,136,164,84,44,71,32,2,171,50,12,70,32,110,64,138,104,183,148,144}

    Returns: 1818

  48. 9

    882

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

    {88,617,263,106,376,485,149,423,510,766,126,218,725,559,296,245,585,450,826,809,609,354,739,26,165,654,633,536,763,456}

    {83,10,137,83,71,22,99,88,143,152,160,96,125,113,158,183,176,124,94,129,14,97,144,171,174,195,174,143,7,152}

    Returns: 3457

  49. 9

    833

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

    {714,516,723,219,605,304,418,194,496,148,531,584,700,605,744,448,707,798,481,306,407,500,170,540,739,30,40,290,683,377}

    {200,152,137,171,2,67,72,41,150,77,143,131,165,180,143,134,5,191,114,85,25,43,59,187,180,24,127,175,133,192}

    Returns: 3447

  50. 10

    851

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

    {476,620,719,240,486,740,506,522,496,170,452,60,547,709,162,38,97,745,739,416,126,243,163,583,420,115,362,787,734,850}

    {192,154,152,70,50,198,29,197,167,157,108,12,138,20,200,85,200,90,140,29,40,123,21,114,197,46,27,51,164,133}

    Returns: 3246

  51. 9

    913

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

    {601,400,344,339,692,207,565,66,579,170,77,505,799,260,425,185,837,623,887,48,233,169,122,894,128,19,171,394,490,651}

    {160,64,125,146,135,138,200,37,127,43,37,21,113,98,20,120,28,110,178,174,28,61,17,183,125,78,18,113,18,126}

    Returns: 2784

  52. 9

    944

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

    {582,318,261,435,762,458,281,551,889,213,910,103,777,248,706,880,865,818,712,706,292,807,843,631,162,587,71,578,329,747}

    {64,141,84,76,78,58,78,24,53,61,57,19,76,157,118,120,191,176,7,194,94,57,29,95,67,188,76,139,62,88}

    Returns: 2668

  53. 8

    983

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

    {655,441,437,663,932,397,551,880,838,952,662,728,322,79,552,880,445,806,694,909,580,48,618,513,535,768,915,225,208,701}

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

    Returns: 6

  54. 9

    826

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

    {717,591,46,785,284,57,649,445,545,8,97,801,126,578,222,330,178,570,694,351,594,639,381,380,304,547,595,378,531,387}

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

    Returns: 0

  55. 8

    899

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

    {731,396,833,327,365,569,517,443,532,691,127,101,644,113,144,893,748,871,443,530,102,441,392,806,252,556,748,321,446,53}

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

    Returns: 4

  56. 9

    907

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

    {92,480,822,807,356,96,718,236,310,375,533,55,650,617,257,320,267,146,502,375,513,255,278,882,657,192,737,225,338,197}

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

    Returns: 1

  57. 8

    937

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

    {5,722,752,239,277,197,365,98,927,15,669,529,931,755,444,710,279,537,109,825,572,686,882,846,523,852,497,457,482,259}

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

    Returns: 2

  58. 3

    4

    {2,1}

    {1,1}

    {1,2}

    Returns: 2

  59. 125

    183

    {40,101}

    {53,150}

    {7,9}

    Returns: 1

  60. 1000

    1000

    {498,499,500,501,502,503,498,499,500,501,502,503,498,499,500,501,502,503,498,499,500,501,502,503,498,499,500,501,502,503}

    {498,498,498,498,498,498,499,499,499,499,499,499,500,500,500,500,500,500,501,501,501,501,501,501,502,502,502,502,502,502}

    {200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200}

    Returns: 5340

  61. 756

    464

    {75,154,411,553,328,383,87,370,306,199,651,92,328,132,55,579,333,95,704,712,382,444,368,298,733,129,741,157,412,587}

    {64,423,289,26,326,233,266,369,341,331,386,408,141,366,84,247,340,111,126,177,60,197,413,126,44,13,141,172,250,386}

    {120,166,116,133,131,101,94,98,147,104,151,111,127,153,142,162,83,151,134,125,128,86,153,95,142,150,130,153,122,145}

    Returns: 3306

  62. 46

    817

    {39,39,3,44,39,14,21,11,30,39,8,38,26,22,15,27,34,19,43,41,12,9,23,14,44,34,14,16,6,20}

    {295,748,209,160,674,167,622,370,575,465,598,62,285,602,603,270,529,752,89,458,539,31,690,381,397,240,764,752,462,196}

    {8,12,25,18,31,4,51,36,21,86,1,65,42,5,92,93,22,32,90,66,38,86,27,53,39,63,80,31,23,52}

    Returns: 1161

  63. 18

    589

    {12,10,2,10,12,1,10,2,6,11,16,5,1,15,14,4,11,9,14,6,1,13,13,2,14,12,11,8,13,4}

    {477,468,550,110,311,200,332,79,566,480,365,574,291,249,266,494,147,551,321,427,368,256,490,54,104,76,518,559,342,79}

    {134,114,131,115,123,134,118,130,129,124,130,131,132,123,126,128,129,119,133,129,123,125,128,129,119,118,130,115,129,134}

    Returns: 3696

  64. 926

    190

    {357,508,155,556,556,3,171,529,602,625,342,190,418,60,671,352,291,420,341,894,823,430,902,291,164,283,145,696,830,908}

    {173,68,144,82,21,166,35,83,54,153,182,12,20,18,158,165,100,60,41,32,181,132,111,13,66,122,71,77,186,33}

    {197,187,189,172,197,195,190,176,187,199,184,190,190,191,199,194,199,180,172,184,186,174,186,182,183,192,173,195,196,188}

    Returns: 5025

  65. 992

    593

    {669,709,278,772,950,669,726,42,869,312,45,786,698,952,95,593,498,741,358,516,816,715,29,984,852,195,257,307,320,753}

    {189,89,215,517,137,153,176,215,381,328,428,449,487,485,354,188,84,257,485,261,368,115,81,122,131,527,203,476,289,509}

    {190,184,184,188,190,190,184,185,191,186,186,186,186,189,187,189,189,190,190,190,190,192,190,187,191,185,185,187,186,192}

    Returns: 4991

  66. 37

    932

    {22,26,35,8,25,24,35,11,19,23,20,32,12,33,5,18,35,4,8,28,10,7,20,23,24,8,5,30,6,9}

    {733,343,283,306,853,578,905,63,133,920,891,313,871,234,741,768,844,749,783,396,379,861,209,798,645,250,179,664,460,253}

    {34,119,6,69,155,148,137,79,137,69,152,134,92,63,108,149,27,154,85,36,67,73,66,33,52,77,96,68,72,183}

    Returns: 2617

  67. 964

    750

    {104,626,42,709,573,673,715,919,387,829,1,552,479,934,311,36,145,863,378,864,858,23,18,157,265,870,730,902,650,556}

    {611,624,246,715,162,587,591,747,206,448,426,473,678,586,272,196,652,129,452,732,393,4,581,313,375,478,356,554,629,346}

    {119,101,111,106,102,101,106,101,115,102,100,117,103,106,100,102,117,118,99,102,110,104,99,109,109,115,115,107,109,100}

    Returns: 2600

  68. 11

    937

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

    {373,723,624,338,904,499,440,516,415,935,286,241,606,231,30,878,600,731,27,914,654,795,842,296,807,466,443,376,254,768}

    {136,179,151,36,127,144,144,96,65,78,82,79,62,119,72,102,147,137,116,92,62,131,65,94,47,71,90,165,147,71}

    Returns: 3042

  69. 10

    620

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

    {79,585,24,300,229,467,588,466,46,385,119,579,220,157,146,64,516,403,500,46,20,371,48,312,14,184,167,545,306,203}

    {41,72,47,60,72,73,53,63,45,75,65,54,78,56,56,46,54,78,57,59,41,62,39,74,71,77,75,73,43,58}

    Returns: 1760

  70. 915

    5

    {546,598,791,368,297,28,25,29,17,196,658,785,695,913,657,319,704,250,364,485,14,88,160,364,142,552,429,816,266,103}

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

    {120,72,102,114,100,84,123,145,86,132,97,104,116,124,150,94,138,84,130,109,111,146,118,85,137,134,103,149,123,101}

    Returns: 2793

  71. 4

    789

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

    {531,440,80,294,606,653,459,109,734,216,533,324,654,561,155,579,39,487,323,698,559,405,536,685,280,28,240,163,598,305}

    {54,55,152,61,155,33,68,43,133,144,86,21,78,108,123,160,66,89,139,17,98,140,63,151,26,113,113,63,164,175}

    Returns: 2861

  72. 9

    979

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

    {226,697,922,299,158,715,219,25,409,972,443,617,32,778,402,108,305,812,572,605,410,82,795,583,440,709,117,66,668,94}

    {31,32,32,33,32,31,33,32,33,33,32,31,32,33,33,31,31,33,31,33,32,31,33,32,31,32,33,31,33,33}

    Returns: 906

  73. 7

    955

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

    {397,845,775,684,189,539,779,422,58,342,724,730,666,336,571,536,513,777,688,83,586,439,903,67,471,139,390,853,69,719}

    {148,182,146,154,178,167,179,195,140,148,159,174,144,183,141,167,192,180,186,175,134,186,169,197,151,147,191,139,166,182}

    Returns: 4951

  74. 1000

    1000

    {565,37,344,542,529,306,99,661,323,139,883,284,583,312,644,265}

    {110,743,165,580,793,977,356,8,798,270,675,137,799,125,649,596}

    {53,68,35,40,73,88,67,61,76,35,43,79,68,38,76,71}

    Returns: 597

  75. 361

    162

    {33,286,253}

    {47,26,39}

    {144,54,56}

    Returns: 218

  76. 347

    373

    {289,120,136,142,85,304,47,60,346,25,52,310,3,344,159,307,17,306,117,55,322,338,102}

    {33,217,360,330,151,119,128,146,336,247,231,110,33,38,222,134,301,244,72,232,364,364,362}

    {152,168,148,25,184,88,136,91,11,93,67,53,83,169,82,84,178,70,99,57,58,124,25}

    Returns: 1982

  77. 491

    52

    {189,148,273,104,317,119,345}

    {17,16,10,1,32,24,16}

    {58,81,87,16,105,85,11}

    Returns: 335

  78. 34

    359

    {4,14,29,26,14,7,6,2,31,13,21,29,15,19,30,14,6,10,15}

    {217,352,190,153,237,291,343,240,181,37,298,89,312,221,312,161,11,32,278}

    {83,105,87,166,34,85,176,130,132,99,155,91,110,143,118,156,156,184,112}

    Returns: 2245

  79. 51

    5

    {35,5,38,6,34}

    {3,4,1,2,1}

    {160,133,103,101,122}

    Returns: 597

  80. 627

    9

    {496,319,160,584,65,209,404,500,582,429,478,50,420,372,524,388,146,136,317,561,413,235,456,470,551,121,456,418,102,270}

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

    {23,22,8,24,12,2,2,26,18,8,5,2,9,14,8,27,8,7,22,13,26,9,5,29,14,7,14,6,27,28}

    Returns: 70

  81. 746

    61

    {677,204,629,115,531,518,358,137,575,389,520,337,391,678,31,366,420,608,390,12,351,395}

    {33,17,26,14,13,16,43,29,58,45,38,50,16,16,30,50,46,26,3,19,11,40}

    {128,125,94,115,78,108,119,147,57,62,54,55,75,61,76,148,92,111,101,71,160,99}

    Returns: 1733

  82. 697

    14

    {219,53,430,250,435}

    {3,9,9,10,8}

    {84,2,78,9,38}

    Returns: 146

  83. 764

    865

    {555,694,505,304,84,421,321,739,283,28,490,583,717,699,576,535,433,304,528,473,59,479,51}

    {28,840,784,138,581,799,85,241,474,458,143,414,644,723,721,763,9,327,363,543,302,818,348}

    {35,19,33,6,13,24,16,11,27,22,35,31,17,19,38,15,22,4,31,6,30,7,36}

    Returns: 157

  84. 58

    425

    {44,28,56,4,37,57,53,27,51,9,5,34,57}

    {229,279,180,419,61,37,366,107,90,147,111,65,123}

    {15,56,20,6,139,33,6,14,144,153,59,159,59}

    Returns: 792

  85. 81

    383

    {12,5,43,7,15,53,34,73,41,57,57,64,16,65,21,4,23,6,57}

    {165,54,283,263,293,301,373,18,69,361,230,64,66,221,152,371,213,175,8}

    {36,20,11,5,36,34,35,21,27,24,35,12,22,20,26,40,14,46,8}

    Returns: 361

  86. 1000

    1000

    {162,599,589,297,593,145,769,537,791,615,100,290,899,640,611,514,68,862,60,297,183,681,51,851,996,955,998,129,402,989}

    {206,371,694,51,355,873,158,297,44,237,739,718,772,129,15,28,6,654,653,201,127,640,10,448,162,293,201,562,383,369}

    {200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200}

    Returns: 5369

  87. 652

    898

    {575,313,305,77,525,131,243,356,81,82,504,478,24,298,435,454,454,247,93,16,43,341,102,471,237,307,356,14,609}

    {302,257,831,180,332,199,228,379,217,528,569,590,712,560,219,583,175,676,581,691,719,555,561,390,239,82,148,673,122}

    {66,68,58,38,25,11,24,57,35,49,74,14,21,15,12,23,15,77,63,21,53,29,79,77,69,59,55,13,15}

    Returns: 727

  88. 753

    867

    {2,338,288,210,441,109,651,416,127,69,256,292,126,77,660,293,541,531,389,661,459,32,266,78,475,279,2}

    {86,287,364,199,246,792,508,711,613,251,129,328,270,691,588,591,614,85,707,342,195,578,186,769,87,653,731}

    {15,48,54,40,51,41,24,43,61,68,31,74,68,23,51,15,71,41,20,48,15,52,80,55,55,17,73}

    Returns: 715

  89. 864

    896

    {506,757,365,435,337,406,553,244,175,300,27,813,780,782,226,487,820,603,495,48,354,92,537,244,350,116,317,321}

    {673,200,765,624,143,276,342,291,304,693,784,552,792,116,234,777,120,542,269,164,229,656,621,623,714,193,309,610}

    {28,10,26,55,71,51,62,15,64,60,58,75,64,60,66,78,33,51,58,30,33,10,32,44,31,34,46,67}

    Returns: 783

  90. 695

    917

    {562,566,386,448,602,540,8,350,431,9,38,268,559,553,110,522,278,665,93,631,262,189,200,62,336,323,536,47,658,480}

    {377,303,591,314,608,93,570,180,160,719,637,602,716,281,539,348,761,230,614,146,744,769,585,358,534,774,279,262,363,150}

    {20,19,72,50,24,21,22,20,59,80,27,31,38,36,44,40,60,37,58,26,43,39,36,32,38,30,54,44,58,43}

    Returns: 699

  91. 912

    951

    {336,699,156,121,757,844,109,181,256,270,193,159,270,895,392,26,863,82,771,711,853,155,253,668,443,706,79,560,184,623}

    {279,237,274,823,363,591,212,752,575,188,900,756,838,138,419,683,799,50,304,251,411,167,74,814,631,187,698,614,796,699}

    {25,55,27,11,40,47,39,33,11,65,72,29,15,65,77,53,75,32,17,44,28,77,58,51,46,48,40,44,65,21}

    Returns: 745

  92. 95

    804

    {24,16,68,84,4,30,26,56,12,62,11,71,57,29,38,85,72,65,72,76,74,89,53,5,36,61,73,66,32,90}

    {81,353,586,582,237,172,293,164,167,59,631,693,503,558,491,324,250,639,221,626,119,614,615,587,489,509,125,605,78,188}

    {52,66,73,64,25,40,11,46,38,45,21,56,32,17,57,79,15,23,50,52,18,15,46,73,52,31,38,60,17,44}

    Returns: 1065

  93. 79

    800

    {3,30,48,26,68,7,61,33,15,13,16,32,5,61,45,4,69,8,13,19,13,24,21,59,67,19,39,23,36}

    {743,322,523,622,320,455,553,367,626,637,592,194,279,192,97,94,38,250,639,41,733,714,600,73,640,745,62,253,197}

    {67,21,79,65,25,10,18,23,50,15,58,17,65,40,72,18,45,63,65,27,79,49,58,26,62,67,80,40,45}

    Returns: 1168

  94. 37

    950

    {22,16,34,19,25,10,4,24,26,24,29,20,10,13,1,26,21,27,33,26,29,10,18,20,3,29,26,24,11,25}

    {690,669,392,315,878,223,727,659,535,528,287,760,337,344,108,79,280,809,580,81,847,757,673,807,323,379,96,603,331,294}

    {73,14,72,30,19,46,13,18,71,76,67,45,35,79,18,40,77,79,24,29,41,64,49,10,27,74,28,27,25,54}

    Returns: 1195

  95. 40

    891

    {14,25,15,39,8,26,8,19,2,33,9,25,35,1,19,2,26,34,15,13,20,21,5,26,23,11,36,26}

    {101,177,814,108,41,255,634,491,94,582,255,184,846,410,751,515,200,717,551,587,748,184,735,191,40,742,51,768}

    {52,79,68,70,31,80,70,61,14,21,59,78,57,69,49,72,25,69,57,58,14,17,14,23,57,17,55,24}

    Returns: 1244

  96. 91

    852

    {25,24,28,61,89,69,70,86,61,37,30,82,50,55,11,21,45,78,37,68,89,40,68,39,81,78,69,11}

    {174,105,611,345,552,138,583,606,542,172,765,305,586,582,309,207,309,713,631,247,303,151,212,555,616,333,581,691}

    {40,11,25,78,33,47,33,80,76,56,34,61,65,55,17,13,35,10,52,43,10,54,17,75,54,51,24,63}

    Returns: 1026

  97. 910

    885

    {525,46,178,612,500,116,122,511,157,747,278,73,743,239,539,256,208,812,771,257,64,834,900,775,95,284,492,505,111,600}

    {738,444,731,435,54,826,825,56,254,344,550,243,141,245,641,438,737,46,342,54,549,835,253,145,138,629,540,345,639,143}

    {95,189,98,38,116,49,22,33,155,116,160,112,116,23,47,127,113,151,103,145,132,38,57,102,94,143,30,38,143,140}

    Returns: 2313

  98. 975

    961

    {92,453,86,290,526,239,650,492,717,127,132,376,221,209,112,219,138,606,216,951,614,456,559,899,287,835,951}

    {212,877,472,486,199,353,624,612,213,744,351,769,60,763,357,65,347,203,897,60,630,766,895,56,472,607,474}

    {70,193,112,60,155,25,85,31,165,75,66,22,175,182,125,123,67,123,171,62,41,79,39,53,115,86,45}

    Returns: 1961

  99. 962

    840

    {69,782,140,692,383,29,659,546,193,796,256,593,576,191,599,251,850,575,416,64,266,427,22,397,810,879,118,277,638,389}

    {387,128,50,708,44,457,220,556,706,625,804,214,803,627,287,472,628,299,126,551,381,220,794,130,543,52,377,290,464,721}

    {151,28,137,120,150,175,101,104,79,70,65,148,27,124,106,21,92,106,160,155,115,193,109,135,80,101,52,97,92,187}

    Returns: 2634

  100. 983

    891

    {906,817,966,38,461,108,279,684,719,330,118,410,205,775,318,277,249,294,467,135,248,77,980,828,715,267,301,127,958,654}

    {787,341,354,572,764,115,356,101,123,789,783,104,568,777,775,557,356,318,564,101,577,98,758,328,107,539,328,337,566,128}

    {112,52,156,163,118,128,159,93,39,176,90,86,52,132,168,132,127,123,60,112,113,41,115,82,140,98,64,160,128,28}

    Returns: 2619

  101. 946

    990

    {534,470,341,249,631,582,506,560,779,245,527,2,458,106,209,418,616,511,503,858,66,346,67,851,343,449,345}

    {741,238,410,402,403,254,422,232,899,86,566,80,80,893,83,585,404,567,923,238,738,586,894,85,737,235,730}

    {157,91,110,39,166,166,156,78,197,158,171,145,102,181,56,30,142,138,190,192,34,126,193,155,90,93,79}

    Returns: 2853

  102. 997

    813

    {919}

    {63}

    {115}

    Returns: 85

  103. 918

    820

    {204}

    {559}

    {31}

    Returns: 5

  104. 946

    960

    {618}

    {319}

    {115}

    Returns: 91

  105. 939

    943

    {439}

    {621}

    {172}

    Returns: 150

  106. 925

    970

    {80}

    {441}

    {72}

    Returns: 43

  107. 945

    12

    {128,82,35,554,606,44,339,838,867,264,310,854,403,76,418,736,519,168,384,156,139,40,78,492,857,245,496,754}

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

    {52,51,81,97,162,190,91,195,156,95,98,148,64,193,31,84,90,135,179,197,158,172,130,98,160,37,51,120}

    Returns: 2696

  108. 918

    14

    {474,306,872,73,163,99,829,291,696,647,638,416,340,913,221,579,882}

    {3,2,5,3,9,12,9,10,11,10,1,6,13,7,3,1,2}

    {38,80,127,139,72,126,157,53,154,133,159,132,158,113,122,175,99}

    Returns: 1685

  109. 953

    12

    {667,469,308,302,950,805,604,806,175,230,341,737,203,753,527,127,806,354,861,83,459,514,78,492,178,419,118}

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

    {127,54,100,89,92,117,118,36,43,77,175,101,83,21,163,42,197,107,60,110,127,188,118,100,166,37,195}

    Returns: 2289

  110. 928

    18

    {527,198,701,843,462,150,13,283,450,439,538,532,812,111,177,3,564,808,825,379,496,662,184,421,889,25,616,343,544,818}

    {3,6,12,3,17,4,3,16,8,2,3,4,17,4,16,9,6,6,7,9,2,13,2,2,17,12,13,17,2,13}

    {176,43,32,151,80,73,118,156,32,164,82,194,131,101,190,128,131,186,144,136,126,58,47,98,177,71,182,175,52,24}

    Returns: 2855

  111. 988

    10

    {535,861,235,332,814,205,277,406,91,381,323,809,181,979}

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

    {184,73,183,146,190,148,62,179,177,145,48,187,51,78}

    Returns: 1556


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: