Question: Given N student and Menemy relations. You need to divide these N students into 2 groups of equal sizes S such that no two

Given N student and Menemy relations. You need to divide these N students into 2 groups of equal sizes S such Input format for custom testing Note: Use this input format if you are testing against custom input or

Given N student and Menemy relations. You need to divide these N students into 2 groups of equal sizes S such that no two students with direct enemy relations are in the same group. You need to maximize the value of S. Also, it is guaranteed that no student will have enemy relations with more than 2 students. Notes . S is the number of students in a single group. . Both groups should have the same number of students .i.e S. Find the maximum possible value of S. Function description Complete the solve function. This function takes the following 3 parameters and returns the answer: N: Represents a number of students M: Represents the number of enemy relations enemy. Represents the enemy relation Input format for custom testing Note: Use this input format if you are testing against custom input or writing code in a language where we don't provide boilerplate code. The first line contains an integer N. The second line contains an integer M. The next M line contains two space-separated integers, u, and v, representing the enemy relation between u and v. Output format Print the maximum possible value of S. Constraints 1 < M < N < 5 105 1 u, v 6 4 1 2 24 15 63 1111 Sample output 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem we need to partition the students into two groups such that each group has no students with direct enemy relations and the sizes ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!