what is mean by each pair of different vertices i and j?

is it all the pairs of array ??..graph on array problem

Delete this as well.

Ask it in comments.

Pair (i,j) means both i and j can take values from [1, N] with i!=j.

For your knowledge, Problem discussion not allowed during the contest, and may lead to your disqualification. Please do not post such thread on discus.

Use the comment section at end of the problem page.

2 Likes
//