can someone tell me what logic i can use to solve this problem?..
You can use Floyd-Warshall to find distances between all the edges and then for each pair check if Dist(u, v) + Dist(v, u) < 0.
My solution link:
CodeChef: Practical coding for everyone
1 Like