Statistics

Problem Statement for "Response"

Problem Statement

We have a number of periodic tasks, each with its own period and execution time. At the beginning of each period of the task (at time 0, 0+period, 0+2*period, ...) a job becomes ready to run, requiring execution time on the cpu.

The jobs are scheduled preemptively, based on the priority of the task to which they belong. Among all the jobs that are ready to execute, the job that is running on the cpu is always a job from the highest priority task. If a job from a higher priority task becomes ready, the currently running job is removed from the cpu and will remain ready to execute, needing only the remainder of its original execution time.

The response time for a job is the time between when it first became ready, and when it completed its execution. Create a class Response that contains a method response that is given int[] period and int[] execution and that returns the response time of the first job of the lowest priority task. If the response time is greater than 1,000,000 or if the first job of the lowest priority task never finishes return -1.

The i-th element of period and the i-th element of execution apply to the i-th task. The tasks are given in order of decreasing priority.

Definition

Class:
Response
Method:
response
Parameters:
int[], int[]
Returns:
int
Method signature:
int response(int[] period, int[] execution)
(be sure your method is public)

Constraints

  • period and execution will both have n elements, where n is between 1 and 50 inclusive.
  • The elements of period and execution will be between 1 and 1,000 inclusive.

Examples

  1. {20,2,27}

    {4,1,8}

    Returns: 32

    The schedule is as follows, referring to the tasks in order as A, B, and C: The first job of A runs from 0-4. Then the first 5 jobs of B are executed from 4-9. Then C's first job runs from 9-10 and is interrupted at time 10 when B's next job becomes ready. The remaining usage of the processor continues as follows: B:10-11, C:11-12: B:12-13, C:13-14, B:14-15, C:15-16, B:16-17, C:17-18, B:18-19, C:19-20, A:20-24, B:24-29, C:29-30, B:30-31, C:31-32. At this point C has accumulated 8 units of cpu time so its first job has finished executing.

  2. {8,8,8,8}

    {3,4,1,1}

    Returns: -1

    The fourth task will never get a chance to execute. The three higher priority tasks each finish one job every 8 time units and are all ready to execute their next jobs at that time.

  3. {17}

    {25}

    Returns: 25

    The first job of the only task gets to run right away with no interruption. The second job of a task cannot compete for the processor until the previous job of that task has completed.

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

    {2,4,6,8,10}

    Returns: 76

  5. {1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000}

    {21,22,23,24,25,24,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20}

    Returns: 20000

  6. {9, 2, 1}

    {4, 1, 1}

    Returns: 18

  7. {320,625,999,1}

    {299,26,24,1}

    Returns: -1

  8. {320,625,999,1}

    {2,28,948,1}

    Returns: 999999

  9. {320,625,101,1}

    {75,330,24,1}

    Returns: 1000000

  10. {2,4,8,16,32,64,128,256,512,1000}

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

    Returns: 512000

  11. {6,991,992,993,994,995,996,997,998,999,1000,1000}

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

    Returns: -1

  12. {320,625,999,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1}

    {2,28,902,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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: 954997

  13. {1,5}

    {1,1}

    Returns: -1

  14. {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}

    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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: -1

  15. {792, 149, 496, 703, 87, 895}

    {20, 26, 31, 28, 59, 83}

    Returns: 6238

  16. {314, 918, 638, 590, 960, 628, 715, 286, 787, 429, 720, 749, 795, 686, 450, 505, 595}

    {36, 48, 31, 62, 56, 25, 11, 2, 10, 59, 39, 38, 54, 5, 61, 27, 15}

    Returns: 5505

  17. {386, 773, 488, 605, 628, 670, 632, 555, 668, 825, 666, 347, 280, 474, 285, 633}

    {35, 24, 13, 39, 68, 67, 15, 12, 17, 1, 49, 22, 41, 50, 24, 67}

    Returns: 6538

  18. {855, 752, 534, 309, 342, 543, 545, 871, 760, 563, 336, 364, 890, 896, 393, 410, 423}

    {23, 43, 56, 19, 27, 17, 54, 54, 41, 38, 12, 25, 60, 10, 61, 1, 22}

    Returns: 13285

  19. {690, 950, 839, 678, 891, 394, 479, 712, 548, 388, 922, 394, 694, 544, 375, 356, 592, 808, 479, 663, 451, 957, 848, 589, 855, 675}

    {31, 30, 18, 1, 16, 26, 23, 34, 26, 31, 20, 12, 41, 19, 34, 22, 29, 1, 9, 21, 34, 30, 1, 35, 16, 33}

    Returns: 27548

  20. {296, 627, 308, 564, 528, 570, 639, 421, 340}

    {58, 83, 81, 10, 6, 30, 76, 77, 56}

    Returns: 6151

  21. {702, 780, 853, 412, 963, 632, 316, 534, 812, 897, 423, 577, 767, 536, 572, 764, 783, 395, 761, 290, 951, 629}

    {1, 38, 27, 32, 17, 22, 14, 21, 36, 24, 48, 11, 45, 16, 1, 7, 13, 48, 13, 51, 35, 9}

    Returns: 6589

  22. {731, 772, 883, 611, 848, 537, 810, 512, 397, 870, 473, 561, 780, 611, 604, 402, 827, 350, 589, 538, 415, 470, 370, 799, 339, 789}

    {41, 37, 37, 10, 7, 27, 35, 7, 11, 19, 24, 31, 18, 22, 2, 35, 20, 4, 25, 11, 36, 33, 5, 3, 33, 19}

    Returns: 5084

  23. {333, 455, 864, 348, 975, 610, 776, 401, 800, 389, 884, 999, 809, 641, 627, 393, 385, 743, 949, 728, 835, 885, 366, 809}

    {21, 39, 18, 41, 48, 9, 47, 42, 40, 9, 2, 21, 16, 3, 11, 37, 24, 22, 10, 7, 39, 29, 13, 21}

    Returns: 9958

  24. {630, 560, 880, 594, 588, 479, 650, 413, 393, 983, 973, 980, 736, 433, 987, 694, 457, 888, 336, 995, 599, 780, 630}

    {30, 20, 30, 32, 1, 9, 50, 51, 51, 22, 47, 9, 18, 20, 30, 13, 46, 35, 21, 30, 13, 13, 29}

    Returns: 30124

  25. {977, 977, 788, 423, 386, 556, 590, 458, 824, 593, 782, 991, 350, 514, 815, 976, 452, 752, 990, 976, 671, 879, 904, 606, 890}

    {14, 8, 43, 30, 41, 35, 6, 43, 6, 13, 20, 32, 39, 13, 34, 30, 32, 34, 41, 1, 42, 8, 5, 10, 28}

    Returns: 7646

  26. {703, 519, 399, 463, 878, 895, 355, 990, 642, 736, 823, 440, 868, 512, 607, 936, 627, 437, 454, 461, 804, 591, 959, 622, 928, 984}

    {7, 6, 42, 28, 26, 39, 19, 20, 9, 26, 8, 18, 31, 28, 40, 24, 12, 11, 10, 26, 40, 34, 35, 38, 10, 9}

    Returns: 5507

  27. {384, 813, 652, 650, 562, 480, 535, 809, 681, 370, 974, 502, 636, 470, 901, 412, 871, 340, 936, 777, 755, 813, 667, 754, 668, 562}

    {3, 33, 16, 21, 23, 31, 13, 29, 42, 33, 35, 2, 1, 13, 3, 38, 40, 34, 35, 31, 17, 26, 36, 30, 14, 15}

    Returns: 11198

  28. {743, 923, 756, 354, 201, 374, 715, 967, 817, 369, 700, 550, 305, 846, 220}

    {6, 75, 75, 65, 15, 1, 8, 51, 27, 46, 53, 15, 43, 40, 26}

    Returns: 5476

  29. {697, 940, 559, 979, 805, 520, 482, 593, 939, 856, 540, 782, 992, 906, 961, 531, 743, 389, 502, 685, 915, 497, 510, 934, 354, 689}

    {38, 37, 24, 37, 35, 4, 27, 32, 7, 2, 28, 24, 24, 40, 38, 5, 29, 38, 37, 39, 26, 11, 28, 12, 23, 6}

    Returns: 58526

  30. {511, 348, 852, 240, 396, 730, 837, 700, 959, 736, 871, 804, 852, 715, 798, 804, 336}

    {49, 66, 19, 59, 13, 18, 8, 33, 43, 3, 37, 64, 31, 14, 37, 36, 36}

    Returns: 14249

  31. {960, 619, 866, 987, 910, 544, 777, 914, 318, 879, 872, 323, 926, 511, 995, 333, 759, 537, 879, 867, 437, 456, 671, 453}

    {32, 14, 32, 20, 34, 45, 20, 30, 34, 17, 8, 36, 26, 2, 47, 16, 37, 20, 35, 15, 39, 9, 29, 20}

    Returns: 5902

  32. {970, 345, 934, 341, 986, 862, 289, 282, 648, 951, 693, 989, 605, 363, 715, 257}

    {18, 63, 39, 36, 35, 5, 17, 12, 51, 53, 70, 72, 16, 54, 14, 55}

    Returns: 41350

  33. {281, 311, 406, 214, 449, 937, 734, 676, 988, 681}

    {70, 75, 2, 27, 63, 13, 13, 78, 78, 72}

    Returns: 14605

  34. {198, 272, 489, 655, 807, 958, 689, 960, 837, 395, 216, 288, 264}

    {23, 43, 13, 12, 19, 25, 41, 20, 7, 80, 31, 50, 77}

    Returns: 7476

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

    Returns: -1

  36. {826, 399, 499, 479, 630, 324, 622, 809, 512, 363, 330, 910, 314, 393, 340, 606, 500, 298, 74, 101, 576, 301, 762, 613, 682, 614, 395, 899, 938, 545, 890, 47, 775, 892, 437, 479, 234, 303, 361, 854, 877, 611, 443, 212, 660, 929, 948, 45, 500, 391 }

    {439, 106, 787, 954, 529, 879, 650, 323, 951, 816, 765, 246, 945, 825, 676, 653, 215, 758, 890, 470, 32, 214, 554, 22, 532, 991, 340, 661, 913, 547, 203, 686, 745, 942, 116, 602, 478, 491, 676, 153, 501, 782, 894, 108, 652, 1, 478, 394, 867, 27 }

    Returns: -1

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

    {2, 4, 6, 8, 10 }

    Returns: 76

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

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

    Returns: -1

  39. {1000, 1 }

    {999, 1000 }

    Returns: 1000000

  40. {1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000 }

    {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 951, 1000 }

    Returns: 1000000

  41. {8, 8, 8, 8 }

    {3, 4, 1, 1 }

    Returns: -1

  42. {1000, 1000 }

    {999, 1000 }

    Returns: 1000000

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

    Returns: -1

  44. {1, 1, 1, 1, 1, 1 }

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

    Returns: -1

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

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

    Returns: -1

  46. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }

    {1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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: -1

  47. {501, 1000, 501 }

    {500, 1, 999 }

    Returns: -1

  48. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }

    {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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: -1

  49. {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }

    {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }

    Returns: -1

  50. {500, 1000, 1000 }

    {499, 1, 1000 }

    Returns: 1000000

  51. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }

    {1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000 }

    Returns: -1

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

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

    Returns: -1

  53. {17 }

    {25 }

    Returns: 25

  54. {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }

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

    Returns: -1

  55. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }

    {999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999 }

    Returns: -1

  56. {1, 3 }

    {1, 2 }

    Returns: -1

  57. {20, 2, 27 }

    {4, 1, 8 }

    Returns: 32

  58. {577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907 }

    {30, 50, 30, 30, 30, 30, 30, 30, 30, 30, 30, 50, 30, 30, 30, 30, 30, 30, 30, 30, 30, 50, 30, 30, 30, 30, 30, 30, 30, 30, 30, 50, 30, 30, 30, 30, 30, 30, 30, 30, 30, 50, 30, 30, 30, 30, 30, 30, 30, 30 }

    Returns: -1

  59. {999, 1000, 1 }

    {998, 1, 1 }

    Returns: 999000

  60. {100 }

    {4 }

    Returns: 4

  61. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }

    {999, 999, 999, 999, 999, 999, 999, 999, 99, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 99, 999, 999, 999, 99, 999, 999, 999, 99, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999 }

    Returns: -1

  62. {1, 1, 1, 1, 999 }

    {1, 1, 1, 1, 999 }

    Returns: -1

  63. {50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 }

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

    Returns: 50000

  64. {10, 20, 30, 40, 50, 1 }

    {40, 4, 6, 8, 10, 1 }

    Returns: -1

  65. {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }

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

    Returns: 207

  66. {16, 16, 16, 16 }

    {2, 2, 2, 2 }

    Returns: 8

  67. {830, 717, 154, 967, 729, 823, 501, 598, 183, 334, 75, 601, 210, 996, 489, 805, 133, 890, 455, 461, 744, 982, 281, 338, 393, 521, 747, 495, 264, 755, 60, 279, 999, 169, 1, 121, 26, 674, 183, 660, 558, 703, 52, 10, 103, 728, 126, 42, 656, 759 }

    {959, 203, 655, 542, 157, 798, 330, 430, 526, 588, 140, 894, 508, 438, 253, 547, 661, 224, 945, 200, 393, 204, 126, 831, 33, 951, 291, 831, 283, 792, 286, 870, 892, 183, 33, 266, 887, 529, 904, 873, 777, 354, 429, 319, 364, 639, 472, 686, 673, 864 }

    Returns: -1

  68. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }

    {959, 203, 655, 542, 157, 798, 330, 430, 526, 588, 140, 894, 508, 438, 253, 547, 661, 224, 945, 200, 393, 204, 126, 831, 33, 951, 291, 831, 283, 792, 286, 870, 892, 183, 33, 266, 887, 529, 904, 873, 777, 354, 429, 319, 364, 639, 472, 686, 673, 864 }

    Returns: -1


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: