Statistics

Problem Statement for "Circuits"

Problem Statement

An essential part of circuit design and general system optimization is critical path analysis. On a chip, the critical path represents the longest path any signal would have to travel during execution. In this problem we will be analyzing chip designs to determine their critical path length. The chips in this problem will not contain any cycles, i.e. there exists no path from one component of a chip back to itself.

Given a String[] connects representing the wiring scheme, and a String[] costs representing the cost of each connection, your method will return the size of the most costly path between any 2 components on the chip. In other words, you are to find the longest path in a directed, acyclic graph. Element j of connects will list the components of the chip that can be reached directly from the jth component (0-based). Element j of costs will list the costs of each connection mentioned in the jth element of connects. As mentioned above, the chip will not contain any cyclic paths. For example:
connects = {"1 2",
            "2",
            ""}
costs    = {"5 3",
            "7",
            ""}
In this example, component 0 connects to components 1 and 2 with costs 5 and 3 respectively. Component 1 connects to component 2 with a cost of 7. All connections mentioned are directed. This means a connection from component i to component j does not imply a connection from component j to component i. Since we are looking for the longest path between any 2 components, your method would return 12.

Definition

Class:
Circuits
Method:
howLong
Parameters:
String[], String[]
Returns:
int
Method signature:
int howLong(String[] connects, String[] costs)
(be sure your method is public)

Constraints

  • connects must contain between 2 and 50 elements inclusive
  • connects must contain the same number of elements as costs
  • Each element of connects must contain between 0 and 50 characters inclusive
  • Each element of costs must contain between 0 and 50 characters inclusive
  • Element i of connects must contain the same number of integers as element i of costs
  • Each integer in each element of connects must be between 0 and the size of connects-1 inclusive
  • Each integer in each element of costs must be between 1 and 1000 inclusive
  • Each element of connects may not contain repeated integers
  • Each element of connects must be a single space delimited list of integers, each of which has no extra leading zeros. There will be no leading or trailing whitespace.
  • Each element of costs must be a single space delimited list of integers, each of which has no extra leading zeros. There will be no leading or trailing whitespace.
  • The circuit may not contain any cycles
  • There will be at least 1 connection.

Examples

  1. {"1 2", "2", ""}

    {"5 3", "7", ""}

    Returns: 12

    From above

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

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

    Returns: 10

    The longest path goes from 0-1-2-3-4-5 for a cost of 10.

  3. {"1","2","3","","5","6","7",""}

    {"2","2","2","","3","3","3",""}

    Returns: 9

    The 0-1-2-3 path costs 6 whereas the 4-5-6-7 path costs 9

  4. {"","2 3 5","4 5","5 6","7","7 8","8 9","10", "10 11 12","11","12","12",""}

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

    Returns: 22

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

    {"","30 50","19 6 40","12 10","35 23","8","11 20",""}

    Returns: 105

  6. {"","","","38 35 14 40 21 19 27 4 31","","","","","","","","","","1 27 37","","29 6 38","","1 45 28","20 26 24 10 17 6","","47 1 24","","","13 7 40 43 8 30 48 10 19","","","7 45 0 2 47","","","","","","","","","","","45 44","7 12 28","4 19 35 9","6 22 46","","48 26 3 22 19 25 40 28","18","","","13 30","","8 15 40 12 45 41 7 0 22",""}

    {"","","","51 45 94 86 94 16 4 36 66","","","","","","","","","","10 39 33","","83 89 12","","13 75 97","52 24 30 87 21 72","","49 15 67","","","90 53 63 36 14 62 81 36 55","","","96 36 87 86 90","","","","","","","","","","","69 100","48 57 47","71 27 21 36","17 39 49","","74 3 17 69 100 90 3 84","16","","","66 52","","40 31 97 67 85 89 90 62 87",""}

    Returns: 426

  7. {"","","","46","","21 29 15 43 30 16","","35 18","","","","","","","47 38","","","","","","","28 35 30 32 44","24 18 14 47 1","","","40 29 43 31 13","","","33 34","13 17 4 40 8 27 16 14 31","3 18","6 33 23 14 36","","","","","","39 40","","3 14 20 38 0 42 35 22 15","","","14 5 23 8","","","","48 19 41","","23","1 37 12 28 4 43"}

    {"","","","3","","19 78 78 19 40 81","","2 6","","","","","","","25 37","","","","","","","89 17 31 80 70","74 5 17 38 94","","","66 20 18 18 100","","","95 60","19 57 39 28 93 96 71 21 2","60 48","56 94 50 11 20","","","","","","10 5","","22 8 39 70 68 64 73 99 93","","","93 56 70 49","","","","77 29 72","","54","56 78 54 48 93 47"}

    Returns: 452

  8. {"","2 36 16","","","","","3","","","","","","15 45 21 47 19 9 11 23 20","","32 1","","","9 30 16 11 4 8","","","","","","","","","","31 4","18 44 3 35 47 34 6 22","40 17","","","","14 2 30 21 20 3 8 47 34","20 35 30 6 40 3 2 45","1 36 7 18","11 23","22 40 21 10 34 15 28 30","","","","17","34 22 45 30 33 1 0 47","","","15","","","47 27 43 31 41 32 16 44 2",""}

    {"","53 82 85","","","","","1","","","","","","88 47 99 35 2 54 11 92 37","","36 65","","","74 61 97 86 54 33","","","","","","","","","","97 48","5 5 79 26 1 36 81 54","6 51","","","","3 36 59 57 23 43 56 89 1","14 74 67 51 4 33 59 55","48 32 53 91","16 54","39 27 25 7 90 41 24 96","","","","8","19 32 5 35 20 66 99 96","","","21","","","39 47 4 63 21 13 6 97 30",""}

    Returns: 348

  9. {"","22 26","","","3 10 34 23","","5","","","","","34 41 22","","","","","","","","13 12","","","","","","","","40 10 44 25 21","","","25 8 32 22 16 3","","","","28 48 3 12 15 40","30 46 40 25 47 48 16","","","","","","","14 0 21","22 41","6 48 47 25 10 23 15 19 33","35 5 37 10 15 16 48 19 6","14","","",""}

    {"","60 60","","","7 12 53 33","","47","","","","","74 81 15","","","","","","","","88 75","","","","","","","","87 36 75 48 49","","","57 79 67 5 42 62","","","","8 89 25 47 54 76","40 80 27 25 47 96 16","","","","","","","30 85 48","26 3","14 42 49 65 40 71 87 44 56","13 68 95 84 24 34 5 88 20","7","","",""}

    Returns: 207

  10. {"","29 45 47 2","9 45 13 26 16 48","","","","","","24 23 7","34 43","41","23 3 37 26","43 23 35 41 10 34 39","","","23 32 38","","40 10 20","","33 37 8 20 29 11","","","","","","45 33 0 37","","14 33 38 46 11 41 9 47","44","","","39","40 46 30 31 34 11","45 15 17","","39 37","","","","","31 20","","","","","","","29 12 10 3 26 30","",""}

    {"","47 55 13 58","64 20 52 44 9 57","","","","","","95 22 64","85 84","93","79 7 47 62","16 28 32 71 61 46 31","","","19 11 88","","99 94 34","","26 24 75 29 71 83","","","","","","95 80 85 78","","29 81 87 69 78 44 12 88","42","","","93","20 20 4 79 61 68","43 81 98","","90 7","","","","","28 95","","","","","","","53 56 67 14 54 62","",""}

    Returns: 399

  11. {"","22 40 8 46","","","","","","22 26","23 29","","","","","","34 22 39 12 31 32 20","","","","","","","","","","","","","","","","6 13 5 3 22 41 11","20 37 13","","","","","","16 39 34 35 24","","","33 2 0 49 6 5 23 27 37","","","","5 8 26 39 36 40","37 41","","","3 7 2 49 42 29 31","33"}

    {"","34 31 94 74","","","","","","50 35","90 33","","","","","","44 79 73 15 76 36 69","","","","","","","","","","","","","","","","77 92 72 79 68 5 29","63 71 42","","","","","","57 47 75 70 91","","","89 12 22 36 78 70 56 61 20","","","","54 2 84 62 45 46","86 18","","","79 3 17 41 77 41 13","52"}

    Returns: 238

  12. {"","24 34","11 35 24","","","","","","","","24 43 21","40 39","","27 48 40 29","13 42 28 11 32","","","34","","","27 11 3 8 24 7 19","","31 23 48 18 1","","","","","","","","","","","49 41 38 45 6 17 35","","","15","2","","","","25 21 40","","","","","10 45 40 6 28 39 27 31 42","21 7 15 26 11 35 8","",""}

    {"","4 93","70 25 61","","","","","","","","28 92 86","78 3","","36 37 69 49","14 87 18 9 35","","","45","","","13 22 2 63 47 51 68","","30 82 97 14 7","","","","","","","","","","","61 52 8 96 96 48 39","","","45","24","","","","73 70 17","","","","","45 17 61 74 22 66 13 63 36","54 15 37 100 69 74 22","",""}

    Returns: 172

  13. {"","18 31 38 4 21 39","18 27","","34 26","","","","31 42 27 12 46 4 43 19","","","","33 0 34 18 38 20","33 29","","48 30 14","1 38 27 44 47 48 11 22 17","0 37 36 45 20 1 13 24","","","","","36 43 39 2 13 44 25 31","","34 33 18","","","","","","","","","","","13 6 43 12 24 4 15 19","","2 46 4 26 12 3 15","","25 9 10 45 14 15 36 48 19","","","","","28 32 6 31 7 3 36","43","","","20 18","40 38"}

    {"","4 77 17 87 53 36","89 37","","89 87","","","","29 18 20 72 6 75 54 43","","","","83 91 59 19 99 64","20 70","","23 6 58","35 23 69 7 44 89 78 72 2","61 44 63 67 63 96 44 64","","","","","74 60 69 31 17 58 83 75","","14 9 33","","","","","","","","","","","23 60 43 30 3 28 80 34","","78 91 60 84 75 12 57","","52 21 75 80 21 99 67 21 45","","","","","61 96 20 52 77 100 86","61","","","64 88","36 9"}

    Returns: 351

  14. {"","","","","","9","14 19 25","","43 40 25 48 36 45 34 0","","","","","","3","","","45 39 12 29 31 0","0 42 10 44","","","32 31 0 19 26","","","20 26 29 33 25 1 37","","","","","","17 15 49 27 44 10 26 21","","","","36","","19 15","","","32 0 49 14 12 33 10 9 37","35","","10 20 39 28 7 6","","","","21 7 14 36 28 1","46 22 16 28 12","",""}

    {"","","","","","73","54 31 22","","89 24 41 80 32 80 24 23","","","","","","80","","","51 79 2 75 54 66","89 2 75 29","","","8 76 63 86 47","","","63 33 26 13 44 73 73","","","","","","29 80 20 9 58 58 19 69","","","","47","","78 72","","","45 50 7 29 100 73 16 39 60","37","","72 37 57 11 86 70","","","","34 37 91 38 6 61","9 27 14 87 8","",""}

    Returns: 217

  15. {"","","","29 45","28 16 44 37 17 36 14","","","","28 49 15 42 0 38 6","","","","3 2","","0 49 29 40","44 47","40 19","12 3","","","31 24 49 2","","","","33 23","","","7 41 29 26","46 21 23 22 12 9","","","35 33 4 10 32 18 46 28 37","","","","","","","36 37 19 20 16 29 22 27","18 21 27 19 5 38 24 4","","3 31 0 48","35","","","","","","",""}

    {"","","","44 66","91 67 51 45 20 25 21","","","","13 19 51 22 36 24 97","","","","61 72","","62 20 9 11","41 72","10 31","87 43","","","52 47 68 97","","","","11 53","","","15 79 7 41","85 28 14 87 47 44","","","97 90 83 23 4 81 52 48 36","","","","","","","63 1 33 50 81 7 43 98","17 34 2 77 6 63 28 100","","77 1 65 31","75","","","","","","",""}

    Returns: 589

  16. {"36","","","37 34 4","","","","","2 7 17 37 31 30 9","","15 13 0 47 22 3 23 49 1","33 13 21","24 23 13 33 40 49","","6 47 4 9","","9 29 31 18 7","27 34 31","","","","","","47 35 7","","","","","","39","","","","","32 45 22 44 11 24 28 5 2","","","","39 29 42 21 2 7","","9 11 0 22 43","11","1 32 21","8 47 23 33 27","","","","21","",""}

    {"62","","","96 1 12","","","","","62 99 93 73 28 4 23","","25 19 54 81 100 53 74 93 11","82 72 54","99 22 17 33 88 53","","89 65 17 8","","61 21 52 15 15","62 7 5","","","","","","9 50 75","","","","","","98","","","","","32 18 30 73 19 66 91 29 1","","","","6 31 32 99 60 78","","91 27 16 93 28","6","11 51 92","73 29 30 45 68","","","","94","",""}

    Returns: 390

  17. {"9 22 1 45 6 2","","","","45 33 16 47 1 38 18 43 24","","16 15 9 48 1 30","37 4 34 13 19 42 17 22 8","25 42","","","","","","","29 18 16 17 23 48 2 46","20","1","","","","","","42 11 3","30 0 40 39","","","","","","39","","","","21 25 49 31 4 37 13","19 41 28 32 47 6","","44 29 49","","29 23 28","","","","1 17 26 35 32 45","","","","","",""}

    {"15 66 51 13 79 4","","","","26 54 68 50 26 36 8 46 8","","73 31 100 83 33 30","5 87 76 36 18 32 10 79 60","74 39","","","","","","","51 61 100 96 88 24 82 77","14","85","","","","","","76 15 45","26 40 2 70","","","","","","56","","","","38 47 42 63 56 11 82","73 7 81 29 91 69","","86 71 78","","50 24 52","","","","10 4 99 77 73 60","","","","","",""}

    Returns: 536

  18. {"","","","","","48 23 18 22 26 2 32 12 39","7 33 21 16 13 31","10","33 39 47 4","","","","","23 19 10 48 47 32 41","17 34 32 3 46 29","31 17 45 41","49 12 15 22 47 34 17 39","","","36 31 46 40 45","","41 0 23","","","","","","","","","","","20","41 26 23 14 20 44 31 1 38","","","","26 18 30 34 47 33 12","","13","","","19 23 11","8 36 24 12 30 47 13","","","","","45",""}

    {"","","","","","83 59 15 91 54 9 6 94 89","69 73 4 71 31 95","13","21 33 15 6","","","","","1 74 27 78 11 9 53","42 80 73 68 8 11","59 73 98 60","85 52 76 68 88 27 47 86","","","1 19 88 26 29","","81 98 71","","","","","","","","","","","24","25 12 81 10 56 23 30 97 80","","","","24 89 51 92 33 94 64","","20","","","2 37 35","20 11 44 82 24 61 98","","","","","40",""}

    Returns: 339

  19. {"42","","17 30","","20","9 25 34 43 11 37 31","36","","","","28 34 27 5","43 37 39 32","22 21 23","","","2 11 4 42 3","4 39 21 0 26 31 47 46 14","6 28 31 38","","","","","","","29 45","","","","","","","","43 12","","","","","","","","38 15","","","","","","2 29 35","","17 25 47 8 30","40 23 4 10 21"}

    {"75","","7 22","","93","94 82 38 10 70 1 92","96","","","","52 100 35 93","70 51 84 93","92 1 84","","","78 77 54 75 48","71 18 48 79 93 56 85 29 94","43 69 6 4","","","","","","","27 29","","","","","","","","33 63","","","","","","","","63 1","","","","","","32 89 84","","57 7 95 58 22","13 45 82 4 6"}

    Returns: 415

  20. {"5 1 15 8 45","34 4","19 17 47 46","","35 28 25 9","","","","20 42 39 41","","","","39 6 7","31 40 23 29 9 22","","","","21 40 43","","","","","","","21","","5","","","21 49","","","","47 14 0 27 8 36","","","25 49 7 34 13 42 24 6","","","49 32 36 5 41 26 6 37","","2 16 9 14","","","0 27 23 25","48 7 16 29 14 26 38 5","","","","34 21 17 4 28"}

    {"89 51 6 20 89","67 20","71 81 6 100","","55 49 7 22","","","","71 31 60 61","","","","33 87 89","41 76 2 7 40 74","","","","89 61 14","","","","","","","45","","9","","","13 85","","","","91 84 7 40 73 39","","","65 33 94 50 49 16 44 80","","","4 41 79 36 3 25 2 90","","52 5 41 75","","","22 88 87 52","63 79 73 54 37 39 45 51","","","","34 54 70 52 88"}

    Returns: 512

  21. {"","","","36 41 1 40 9 13 10 18 25","","","36 1 20 26 38 11 22","1","21 11 30 2 41 38","","","28 49 20","35","7 20 8","","","","11 34 41 29 9 19 5 43","37 19 6 26 21","30","","7 35 20 4 33","","","","","","1 12 13 16","","","","","","","","","26 49 33","","","3 2","31 35 32 34 42 8","","","","5","39 17 35 13 28","25 11 22 28 23 18 45","","",""}

    {"","","","58 89 10 24 8 65 33 71 21","","","77 16 9 8 40 10 35","59","15 1 4 93 69 12","","","28 49 56","34","55 20 97","","","","72 13 17 80 81 95 13 54","14 67 37 16 63","39","","16 33 30 11 78","","","","","","52 65 97 68","","","","","","","","","52 25 76","","","50 41","98 28 86 75 46 32","","","","99","36 70 2 54 3","65 88 92 41 51 62 37","","",""}

    Returns: 384

  22. {"","","","","","10 36 16","","","","","","7 25 45 28 34 40 48 44 24","","6","","18 34 31 40 22 25","","18 3 32 38 8 31 27 44","25","","","","21 42 26 9 3 10 4","","8","","","25 30 42 3 11 20","","","25 31 43 1 23 48 37 12","","","","","32 0 44 17 27","","","","","","14 12 25 13 15 44 39 42 37","","","","","","","","25 18 48 43 47 6 37"}

    {"","","","","","10 13 72","","","","","","7 42 4 58 62 45 26 43 85","","43","","2 8 36 8 35 22","","70 94 91 58 73 62 90 40","3","","","","2 46 14 55 79 95 99","","18","","","27 69 60 36 12 88","","","82 61 95 28 35 49 19 8","","","","","57 16 71 39 89","","","","","","91 43 31 60 40 59 93 77 15","","","","","","","","31 43 92 44 64 46 6"}

    Returns: 293

  23. {"","","","","","","","","","37 45 15 13","","","33","","","28 46 16 18 11 14 1","","","","23 9 40 28 20 32 27 45","","","","","","28 37 31 10 35","4 34 39 27 7","23 11","","0 15 31 5 41","","41 44 34 43 21 40 26","","28 29 39 4 6 24 30 26 38","","31","","","13","","1 42","28","","","","","","","",""}

    {"","","","","","","","","","2 14 8 8","","","54","","","89 18 14 2 28 50 44","","","","48 94 27 39 98 33 16 61","","","","","","74 26 28 68 11","32 15 34 56 34","3 10","","97 10 51 59 68","","8 82 79 12 51 99 18","","68 88 97 76 82 69 36 78 15","","11","","","90","","29 6","3","","","","","","","",""}

    Returns: 321

  24. {"","","46 15 5 32 17","","36 38 6 26 31 44","","22 5","16 40 10 48 24 49 32 20 43","","","","","","37","","","44 17 2 33 26 31","","","31 1 38 32 46","","6 3 13 11 23","","","","","14 35","","31 1 17 10 33 49 47 26","","","","","","8","43 24 12 13 49","","","","34","46 13 0 20 38 5 39 9","","","34 31 42 36 2","","","27 30 6 10","","",""}

    {"","","33 11 2 64 93","","98 44 83 30 84 66","","75 6","29 6 7 27 81 62 38 15 98","","","","","","13","","","73 36 63 82 60 73","","","18 68 35 55 3","","18 26 17 99 48","","","","","2 43","","61 45 36 45 1 79 75 29","","","","","","16","22 44 84 45 33","","","","9","2 60 52 40 80 90 83 20","","","39 16 44 85 47","","","24 78 81 74","","",""}

    Returns: 390

  25. {"","19 48 46 5 26 38","","45 38 20 10 47 35 22","","","","","45 30 15 12 40","","","28 13 10 34 16 47","19","18","","","35 1 46 14 4 6 42 43","","","","45 5 2 31 11 19","13 5 11 12 24 14 34 47","","","16 15 8 38 19 30 6","","","37 43 48 46 38","","","","","33 37 17","45 15 29 27 42 19 43 24","","","5 7 20 6 2 35","","","","","28 42 49 29 20 22 6 8","","","11 23 5 10 46 24 22","","","","","23 18 47 33"}

    {"","52 40 17 27 21 28","","45 70 75 78 70 5 61","","","","","2 12 57 80 82","","","20 17 65 43 61 73","30","26","","","25 21 7 10 55 15 77 24","","","","82 27 46 22 91 100","29 66 73 63 32 89 32 56","","","73 70 13 84 22 26 85","","","81 54 13 25 91","","","","","35 83 58","15 2 68 8 25 86 13 64","","","79 43 83 40 73 88","","","","","28 78 100 28 46 94 45 5","","","46 72 58 23 27 43 46","","","","","97 26 34 95"}

    Returns: 409

  26. {"","36 33 19 21","","45 26 38 5 9 35 28 18 19","","","","","32","31 8 27 20 29 10 1 12","32 6 47 2 13 4 27 24","","","","","38 12 14 44","","","25 48 44 46 4 29 19 24 38","","","","36","","26","","46 8 19 35 21","","","","48 6 33 39 38 24 7","","","13 46","","","38 0 33 11 30 4 15","22 5","","","","","","","","10 21 11 0 31 43","","13 20 28 16 25 43 29 17","",""}

    {"","11 4 47 9","","22 3 12 32 61 70 81 92 33","","","","","59","49 59 42 31 89 94 60 45","43 16 33 56 86 74 100 36","","","","","72 91 85 58","","","31 66 32 92 87 66 76 1 46","","","","85","","75","","67 17 81 88 13","","","","74 59 37 1 63 32 85","","","59 7","","","50 72 38 90 69 51 82","81 13","","","","","","","","51 46 55 23 95 62","","57 21 60 72 55 69 68 14","",""}

    Returns: 430

  27. {"","","","","","7","","13 38 39 33 27 44 29 11","","","","45 16 35 21 44 49 27 19","","","27 8 46 41 10 11 25","46 42 47 45","","","","","17 27 32 31 45 9 49","17","","","","","17 5 15 39 25","","","","8","30 43 9 42 39 2 11","36 19","27 11 45 36 32 14","","","","","","19 3","20 18 5","","","","","42 30 32","","21 8 38 6 23","25",""}

    {"","","","","","49","","61 94 34 74 26 4 17 22","","","","6 19 36 21 86 6 34 5","","","7 54 99 78 21 51 58","43 79 19 83","","","","","10 53 48 49 66 93 43","45","","","","","28 33 14 30 77","","","","72","79 48 75 42 98 68 59","13 32","72 12 50 14 29 24","","","","","","42 93","48 27 77","","","","","71 7 46","","100 23 100 20 24","73",""}

    Returns: 361

  28. {"","","","","49 41 30","","33 22 14 40 7 10","","40 22 25 35 44 18 36 38","","","","","","42 27","","24 41","","","31 18","","","","","","","","","","","","","","","","","16 24 34 44","","","13 16 31","","","","","16 23 37 0 1 17 6","","","","23 3 32 21 33 6 9 0 19",""}

    {"","","","","50 25 12","","33 68 92 42 65 28","","11 20 52 34 37 74 86 72","","","","","","50 96","","1 49","","","84 8","","","","","","","","","","","","","","","","","73 19 89 79","","","45 9 67","","","","","8 27 65 68 80 51 84","","","","6 64 94 42 61 71 40 47 25",""}

    Returns: 437

  29. {"","","","","","","","","","","","","5 31 32 47 10 36","","","","9 1 42 41","","","38 45 14","","4 34 12","","","31","","","","","","27 40","","","","","","","38 29 4 21 41 24 49 13 35","","13","27","","","20 28 14 21 36","","29 9 40","","29 33 32 36 40","","41 21 19 25"}

    {"","","","","","","","","","","","","85 28 15 25 5 98","","","","61 54 26 34","","","86 98 78","","99 40 33","","","59","","","","","","15 21","","","","","","","68 68 9 24 28 93 42 71 55","","99","50","","","60 15 10 55 92","","44 9 91","","76 34 18 25 64","","34 16 71 74"}

    Returns: 352

  30. {"","36 28 21 29 24","","","","44 35 33 22 27 45 42 43","47 44 22 35 11 4 41","4 49 40","","","","","26 33","","22 15 9 31","23 47 33 41","32 24 10 38 30 34","","","","","","","","","","","34 44 45","44 34 24 15 0","12 43","","47 16 41 46 17 10 4 30","","","4 47 35","","13 17 44 49 34 23 32","","","","19 5 20 42","","","","10 15 20 31","30 20 33 2 17 26 18","","","",""}

    {"","17 28 93 92 55","","","","16 83 95 54 91 20 20 31","52 93 59 10 14 12 41","25 3 50","","","","","38 35","","44 58 52 55","78 7 67 15","80 79 17 98 60 55","","","","","","","","","","","98 98 80","3 94 52 59 33","48 80","","40 49 6 67 34 73 20 54","","","88 87 76","","22 20 47 10 6 4 42","","","","66 88 95 60","","","","87 61 70 49","79 91 92 26 84 88 51","","","",""}

    Returns: 568

  31. {"","42","46","23 39 40 21 4 5 6","","","","27 35 28 34","","","42 29 47 32","1 27","49 40 39 7 31 10 48","27 47 33 41 39","46 11 21 13","6 20 47 2 17 33 21 14 29","","13 36 31 6 37 7","5 7 37 31 34 40 26","","","","","","","38 43 22 42 1 26","","","39 10","","32 43 14 18 47 20 45","48 40 10 27 4","","","","","","","16","","","4 28 25 12 31 43 18 20 27","","","","29 7 21 8 24 40","29 36 37 0 10","","2 33 47 9 45 22",""}

    {"","70","77","33 33 71 79 75 51 31","","","","26 24 18 29","","","55 37 22 43","60 50","90 98 11 64 44 8 22","92 92 32 42 48","50 30 16 86","96 83 26 70 75 77 79 99 4","","26 83 37 77 52 9","21 43 82 56 31 60 2","","","","","","","13 43 83 3 66 72","","","17 47","","21 6 77 53 95 34 75","86 76 80 37 4","","","","","","","1","","","74 7 96 82 54 85 28 96 28","","","","70 83 22 63 94 78","68 65 31 49 2","","86 29 73 1 55 78",""}

    Returns: 697

  32. {"","","","","","","","","9 6 28 41","23","","","","","26 6","","39 31 13 23 4 27 44","","25 15 21 2","34 6","0 13 33 43 17 34 12 6 2","","5","","2 9 46 1 18 17 32 31","","","11 23 41","42 6 4 15 41 10 34 21 20","","37 43 7 6 8","11 6 9","","1","","","47 23 16","","","","4 2 25 46 47 1 32","","","","","16 7 13 3 9 25","","","","43 35"}

    {"","","","","","","","","89 85 64 56","62","","","","","49 30","","49 84 20 43 42 72 49","","37 4 95 20","39 38","65 46 82 41 80 7 4 65 13","","36","","73 9 56 29 42 88 12 81","","","49 97 52","60 95 65 61 66 32 38 46 41","","96 84 17 78 28","95 47 19","","31","","","19 63 23","","","","49 44 87 25 82 78 4","","","","","56 27 77 77 22 84","","","","36 26"}

    Returns: 246

  33. {"","","","","","","","","","","","24 0 47 28 26 36 10 40 6","","","26 21 46 22 5 3","","","","","","","","","30 40","","44 39","","","","31 1","19 37 14 25","","","","","","","8 1 11 38 47 46 36 10","","31 43","27 13","","","","","","21 32 34 27 8","","",""}

    {"","","","","","","","","","","","12 58 98 97 62 92 3 36 21","","","99 90 5 61 43 82","","","","","","","","","80 25","","41 5","","","","46 95","1 84 69 94","","","","","","","15 80 21 75 59 52 60 99","","34 29","37 25","","","","","","78 72 15 44 83","","",""}

    Returns: 299

  34. {"","33 0 4 34 41","","","19 15","","","37 32 34 14","47 15 19 22","","","","","19 1 10 48","","","33 6 26","","","5","","","40 20 48","15 21 3 12 37 5 0","","35","","","41 10 5 2 9","0 43 37 34 26 24 14","","28","","","","","31 28 5 38 43","","44 30 5","","26","","","15 3 45 42 17 23 8 11","","","","37 20 27 42","",""}

    {"","79 1 89 57 96","","","75 75","","","45 74 37 69","70 55 55 21","","","","","55 95 34 4","","","32 9 36","","","33","","","70 19 16","6 89 12 35 99 51 86","","12","","","12 95 96 58 81","74 9 25 18 5 83 26","","38","","","","","73 26 67 93 19","","30 13 31","","73","","","70 13 25 65 12 52 32 78","","","","34 56 82 71","",""}

    Returns: 292

  35. {"","16 0 30 48 14 26","27 41 8 1 5 43 40","","","30 25 0 48 16","","","","44 6 2 15 24 4 45 3","","","","","44","13 11 39 37 24 21","","","","","","","13 18 48 33 39 15 47","","","","","","5 47","","","12 18 25 34 4 23 44 21 45","","","16","","","","3 20 15 33 22 8 30 44","","24 22","31 34 19 14 43 4 24 15 21","33","","","","19","","",""}

    {"","46 26 37 26 11 36","93 20 83 81 85 84 39","","","83 7 54 77 63","","","","33 26 20 11 1 41 85 81","","","","","100","42 23 70 2 77 3","","","","","","","61 67 16 31 57 35 57","","","","","","51 95","","","28 83 61 38 36 85 25 18 27","","","84","","","","99 14 80 100 17 91 19 48","","83 1","62 82 72 55 84 100 96 39 23","1","","","","94","","",""}

    Returns: 224


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: