Dicription You have a connected directed graph.Let $d(x)$ be the length of the shortest path from $1$ to $x$.Specially $d(1)=0$.A graph is good if there exist $x$ satisfy $d(1)<d(2)<....d(x)>d(x+1)>...d(n)$.Now you need to set the length of ev…
The path Time Limit: 2000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ID: 538564-bit integer IO format: %I64d Java class name: Main Special Judge You have a connected directed graph.Let d(x) be the length of the shorte…
three version are provided. disjoint set, linked list version with weighted-union heuristic, rooted tree version with rank by union and path compression, and a minor but substantial optimization for path compression version FindSet to avoid redundanc…