Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Even random tests almost never generate highly disconnected graphs, usually the expected value is around 0-5, so a brute-force solution might have hopes to work.

  • Default User Avatar

    Hello! Your solution code seems to fail in some test cases such as:

    print(airlines([[2, 10, 1, 9, 4, 11, 5], [3, 10, 5, 1], [7, 3, 10], [2, 3, 6, 4], [8, 6, 9, 10], [4, 7, 9], [3, 2], [2, 3], [6, 10, 8, 4], [5, 6, 2], [2, 4], [4, 6, 7, 5, 9, 0]]))

    should return 1 instead of 2

    print(airlines([[3], [0, 1], [3, 6, 5, 11], [10], [6, 7, 3, 0, 10], [4, 11, 0, 6, 7, 5, 9], [], [2, 10, 5], [0, 6, 2, 5, 11, 7, 3], [3, 6, 11, 4], [], [6]]))

    should return 2 instead of 3

    print(airlines([[8, 5], [1, 3, 6], [], [9], [3, 4, 5, 7], [9], [3], [0], [2, 3], [3, 9]]))

    should return 2 instead of 3

    print(airlines([[4, 3, 8, 1, 6], [8, 1], [5, 6], [8, 4], [], [2, 6], [4], [], [6, 4], [8, 5, 7, 2, 9, 4, 3]]))

    should return 2 instead of 3

    print(airlines([[5], [14, 5, 3, 10], [7, 3, 1, 2, 10, 5, 14], [4, 10], [5, 13, 9, 7, 6, 11], [], [], [5, 9], [12, 8, 9, 1, 4, 11, 13], [1, 7, 14, 13, 11, 4, 9], [8, 10, 14, 1, 7, 4, 2], [6, 5, 14, 3, 4, 13, 10, 11, 12, 9, 7], [13], [2, 7, 3, 6, 1, 4, 8, 9, 10, 14], [2]]))

    should return 2 instead of 3

    print(airlines([[], [1, 4], [0, 3, 8], [3, 5, 8, 4, 2], [5], [5], [4, 0, 6], [5, 7, 9, 4, 0], [6, 3], [8, 9, 4]]))

    should return 2 instead of 3

    print(airlines([[], [8, 7], [0, 2], [], [4, 8, 2, 7, 9, 3, 10], [7, 9, 8, 2, 4], [4, 3, 0], [8], [], [3, 7, 9, 10, 6, 2, 8], []]))

    should return 4 instead of 5

    print(airlines([[], [], [1], [4, 8, 1, 2, 3], [], [4, 3], [], [], [1, 8, 2], [4, 9]]))

    should return 5 instead of 6

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution