Ad
  • Custom User Avatar

    Could someone advise whether I am misinterpreting the instructions, or whether this is an incorrect test:

    # printed args (with multiple lines of the data arg removed to make it more concise)
    data = [
        ...,
        (92, 3231),
        (2332, 92),  # used in P  # 2332 is a friend of the prince
        (92, 7178),
        (8138, 8473),
        (92, 2690),
        (9248, 2332),
        (92, 9883),
        (92, 5203),
        (698, 4683),
        (698, 4515),
        (81, 5122),
        (81, 1537),
        (5290, 1858),
        (9782, 5290),  # used in P
        (5290, 698),  # used in P
        (698, 3582),
        (698, 1922),
        (81, 92),  # used in P
        (81, 6645),
        (9782, 2332),  # used in P
        (8138, 4800),
        (81, 6611),
        ...,
    ]
    prince_id = 92
    thief_id = 698
    

    The test result says 81 (among other similar examples) should be included in the output.

    The rows with # used in P noted appear to be used in a path ([698, 5290, 9782, 2332, 92, 81]) which contains a friend of the prince (2332). This leads me to believe the ID of 81 should not be included as per the formula in this section in the instructions:

    To explain this mathematically, denote $F$ as the set of friends of the prince.
    Let $f \in F$ be the friend of the prince and $t$ the thief of the treasure. Now,
    denote $P^t_f = { p_1, \dots, p_n}$ as the set of all the people in a
    friendships path between $t$ and $f$ excluding them. $f$ is a suspect if and
    only if there is a path between $t$ and $f$:

    $t → p_1 → p_2 → \dots → p_n → f$ such that for all $p \in P^t_f$ , $p \notin F$

    Is it simply that the end of the formula is not accurate ($ p \notin F $), or am I mistaken?

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    This does not happen on all tests, some work as expected.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    I said "Good day, sir!"

  • Custom User Avatar

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

  • Custom User Avatar

    I know I am biased as my solution is very similar, but this is the most implicit type of solution I have seen.

  • Custom User Avatar

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

  • Custom User Avatar

    One liner solutions explains how good they are with their stuff.

  • Custom User Avatar

    Most definitely! I do like to see if I can do a one-liner but I would rarely use something like this in my code. I am fairly new at this (coding in general), so the clever solutions really help with awareness of other methods etc.

  • Loading more items...