• + 0 comments

    Okay, I had a really hard time trying to understand the sample input, and on reading bretvh's discussion, I have understood it. It seems that people could not understand, and so I will try to explain it to people so they get what you are supposed to do.

    The first is pretty clear...He does [1,2] and then does [2,3], which does NOT have any path in common.

    Now, for the example [1,2], and [3,4], this is what happens.

    He does [1,2].

    He then teleports to the city 3. From city 3, he maintains [3,2] AND [2,4]. These two add up to [3,4].

    So, he has done [1,2] and [3,4] without any path being repeated. This is thus counted in the total