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

Two groups 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 le 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 M Represents a number of students M Represents the number of enemy relations enemy Represents the enemy relation Input format for custom testing A Note Use this input format if you are testing against custom input or writing code in a language where we dont provide boilerplate code The first line contains an Integer N 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 dont provide bollerplate code The first line contains an integer N The second line contains an Integer M The next M line contains two spaceseparated Integers u and v representing the enemy relation between u and v Output format Return the maximum possible value of S Constraints 1MN5 105 1 u v N Sample input 6 4 1 2 2 4 1 5 6 3 Output 3 Explanation Givert N6 M4 enemy 122 4 1 5 6 3 Approach You can form two groups in the following we 1st group 146 2nd group253 You can see no direct enemies are in the same group and hence the maximum possible value of s2 A Note Your code must be able to print the sample output from the provided sample input However your code is run against multiple hidden test cases Therefore your code must pass these hidden test cases to solve the problem statement In c for input 28 26 20 27 12 10 18 4 7 27 15 18 22 5 13 22 8 23 5 19 19 4 13 14 1 24 23 15 20 6 26 17 6 25 26 14 3 7 17 10 28 3 24 11 8 9 16 1 11 9 12 16 28 21 output 13

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Accounting Questions!