Problem 1782 · Hard

Count Pairs Of Nodes

Count pairs by degree sum with two pointers, then subtract the pairs whose shared edges were double-counted.

Open the interactive visualisation