Statistics

Problem Statement for "Internet"

Problem Statement

One of the many nice things about the internet is that it doesn't have a central server anywhere in the world. That is, the internet is decentralized. In theory, this means that if a router (a device that makes sure messages reach the proper destination) connected to the internet crashes, it's still possible to create a connection between any two remaining routers. In this problem you are to examine how true this is, given a configuration of how the routers are connected to each other. Two routers can be connected either directly or indirectly (i.e. by passing through one or more directly connected routers). Initially, all routers are connected to each other.

A router is an articulation point if the removal of that router will split the remaining routers into (at least) two parts. That is, if there exist two routers, neither of which is the removed router, which after the removal can't connect which each other.

The configuration will be given as a String[], where each element describes one router (the first element being router 0, etc). Each element will contain a space separated sequence of non-negative integers. If the integer j appears in element i then router i is directly connected with router j. There will be exactly one space between the integers, and there will be no leading or trailing spaces. No integer will contain any unnecessary leading zeros. All direct connections are bi-directional, so if the integer i is in element j, then the integer j will be in element i. All integers will be valid routers.

For example, if input is {"1 2","0 2","0 1 3","2"}, we have the following configuration of routers:


 0
 |\
 | \
 |  2-----3
 | /
 |/
 1

There is one articulation point, namely router 2. If this router is removed, then router 3 is disconnected from routers 0 and 1.

Create a class Internet which contains the method howMany which takes as input a String[] routers in the format described above and returns an int containing how many of these routers are articulation points.

Definition

Class:
Internet
Method:
articulationPoints
Parameters:
String[]
Returns:
int
Method signature:
int articulationPoints(String[] routers)
(be sure your method is public)

Constraints

  • routers will contain between 2 and 50 elements, inclusive (this is a very small internet).
  • Each element in routers will be between 1 and 50 in length, inclusive.
  • Each element in routers will contain only digits ('0'-'9') and spaces (' ').
  • A router will never have a direct connection to itself.
  • There will be at most one direct connection between two routers.
  • If the integer i is in element j of routers, then the integer j will be in element i of routers.
  • All routers will be connected to each other.
  • Each element in routers will only contain integers between 0 and (number of elements in routers)-1, inclusive.
  • There will be exactly one space between the integers in the elements in routers, and no leading or trailing spaces.
  • No integer in the elements in routers will contain any unnecessary leading zeros.

Examples

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

    Returns: 2

    If router 2 crashes, the remaining routers will be split into three parts, one containing the router 0, another the routers 1 and 3, and the last one routers 4, 5 and 6. If router 4 crashes, there will be two parts: one containing routers 0, 1, 2 and 3 and the other containing routers 5 and 6. If router 0, 1, 3, 5 or 6 crashes, this will not split up the remaining routers. Thus only router 2 and 4 are articulation points, so the method should return 2.

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

    Returns: 10

    The 12 routers are connected in a long chain. This means that if a router crashes it will disconnect the remaining routers unless the crashed routers is one of the endpoints. Since there are two endpoints (routers 5 and 8), the method should return 10.

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

    Returns: 0

    The routers are now connected in a ring, so if one router crashes, this will not disconnect the internet. The method should thus return 0.

  4. {"1 7 12 13 15", "0 2 6 4 7", "3 5 6 1", "4 5 2", "3 1", "3 2", "2 1", "1 0 8", "7 9 10 11", "10 11 8", "9 8", "9 8", "0 13", "0 12 14 15", "13", "13 0"}

    Returns: 5

    The routers 0, 1, 7, 8 and 13 are articulation points, so the method should return 5.

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

    Returns: 0

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

    Returns: 48

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

    Returns: 1

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

    Returns: 7

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

    Returns: 22

  10. {"2 14","7","0","7","14 17 18","19","10 18","1 3 12 16","13","12 19","6 15","17","7 9 13 18","8 12","0 4","10","7","4 11","4 6 12","5 9"}

    Returns: 12

  11. {"4 13","9 10 16 18","7 13","4 10 11 18","0 3 11 17 18","13","8 11 19","2 10 12 16 18","6 12","1 12","1 3 7","3 4 6","7 8 9","0 2 5 14","13 16","17","1 7 14","4 15","1 3 4 7 19","6 18"}

    Returns: 3

  12. {"2 5 8 12 17 19","13","0 4","5 10 11 13 19","2 12 14","0 3 6 9 10 14 16","5 12","9 12 16 19","0","5 7 12 15","3 5","3 12 17","0 4 6 7 9 11 16 18","1 3 14 17","4 5 13 16 17","9","5 7 12 14","0 11 13 14","12","0 3 7"}

    Returns: 4

  13. {"4 6 7 11 13","8 12 15 17","4 15 16 19","4 12 15","0 2 3 7 11","7 9 14","0 14","0 4 5 12 14 16","1 13 15 18","5 10 13 15 16 18","9","0 4 14","1 3 7 14 17","0 8 9","5 6 7 11 12 16 19","1 2 3 8 9","2 7 9 14 18","1 12","8 9 16","2 14"}

    Returns: 1

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

    Returns: 0

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

    Returns: 0

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

    Returns: 0

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

    Returns: 0

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

    Returns: 11

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

    Returns: 0

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

    Returns: 0

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

    Returns: 1

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

    Returns: 2

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

    Returns: 7

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

    Returns: 13

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

    Returns: 15

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

    Returns: 15

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

    Returns: 22

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

    Returns: 21

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

    Returns: 25

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

    Returns: 21

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

    Returns: 18

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

    Returns: 21

  33. {"1","0"}

    Returns: 0

  34. {"1","0 2","1"}

    Returns: 1

  35. {"1 2","0 2","0 1"}

    Returns: 0

  36. {"1","0 2 3","1","1"}

    Returns: 1

  37. {"2","2 3","0 1 3","1 2"}

    Returns: 1

  38. {"1 2 3","0 2 3","0 1","0 1"}

    Returns: 0

  39. {"1 2 3","0 2 3","0 1 3","0 1 2"}

    Returns: 0

  40. { "2", "2 3", "0 1 3 4", "1 2", "2 5 6", "4 6", "4 5" }

    Returns: 2

  41. { "1", "0" }

    Returns: 0

  42. { "1 7 12 13 15", "0 2 6 4 7", "3 5 6 1", "4 5 2", "3 1", "3 2", "2 1", "1 0 8", "7 9 10 11", "10 11 8", "9 8", "9 8", "0 13", "0 12 14 15", "13", "13 0" }

    Returns: 5

  43. { "1 2", "0 2", "0 1 3", "2" }

    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: