Redirecting to
NADOS

Perfect Friends

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

1. You are given a number n (representing the number of students). Each student will have an id 
from 0 to n - 1.
2. You are given a number k (representing the number of clubs)
3. In the next k lines, two numbers are given separated by a space. The numbers are ids of
students belonging to same club.
4. You have to find in how many ways can we select a pair of students such that both students are
from different clubs.
Input Format
Input has been managed for you
Output Format
Check the sample output
Question Video
Constraints
None
Sample Input
7
5
0 1
2 3
4 5
5 6
4 6
Sample Output
16


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name