Red Huang

Red Huang

Codeforces Round #179 (Div. 2) D. Greg and Graph

Tendency towards thinking problems

The problem seems complicated, but you can think about the principle of Floyd

It enumerates the intermediate points, and then compares them pairwise to get the shortest one

And this problem can be seen as an empty graph with one point added at a time

Then take that point as the intermediate point to do Floyd

So Floyd only needs to be done once to get it done

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.