Question: Please solve it ASAP, I will upvote. Thanks, The preferred language is CPP/Java/Python, Just make sure the logic is clear. undefined 1 3. No of
Please solve it ASAP, I will upvote. Thanks,
The preferred language is CPP/Java/Python, Just make sure the logic is clear.




undefined
1 3. No of Ways Students Get Placed ALL This is the placement season for IT campus. In total companies (1 to X) are visiting the campus. There are total N students who are appearing for interviews. Each student has his/her preference list of companies for which he wants to appear in the interview. Your task is to find out number of ways the students gets placed such that following conditions are satisfied 5 7 8 . Each student gets job from his/her preference list. No two students gets placed in the same company Each student gets exactly one job 10 11 12 13 14 15 15 17 18 19 20 21 22 TUTTE Input Format First line contains x the number of companies visiting the campus Next line contains the number of students. The subsequent N lines contains the list of preferred companies of the students. For each student (23-1/" line contains the size of his preference list while 2fline contains the space separated integers representing the preferred companies for student. Note : Students can put same company multiple times in their preference list. Constraints IX20 . IN 10 . 1 X where I sis Xand size, is the size of the preference list of the companies of the student Output Format Print the total number of ways students gets placed based on the conditions specified. Output the number modulo non # Sample input 1 ALL Sample Output 1 1 Sample Input 2 2 . 1234 2 35 Sample Output 2 Tere Sample Output 2 ALL Sample Inputs 5 le 5 5 5 225 5111 231 2 353 2113 Sample Output 3 ALL Explanation Sample Case x-5N-2 The preference list of 2 students is 4 4 3 2 Students can get job in only 7 way such that no 2 students get placed in the same company and each student gets placed in exactly 1 company of his preference. Sample Case 2 X=5, N=2 The preference list of 2 students is 1 2 3 4 35 Students can get job in only 7 ways such that no 2 students get placed in the same company and each student gets placed in exactly 1 company of his preference. 13 1 5 2 3 25 H C 1 2 3 4 ALL Students can get job in only 7 ways such that no 2 students get placed in the same company and each student gets placed in exactly 1 company of his preference. 13 15 23 25 35 4 3 4 5 2 Sample Case 3 X = 5, N=10 The preference list of 10 students is 5 3 3 5 3 5 2 2 3 11 3 3 5 5 1 2 2 4 3 5 5 2 1 2 3 2 2 5 2 2 5 1 1 1 1 2 3 4 1 1 2 3 5 3 5 211 3 2 There is no way we can allocate jobs to students such that no 2 students get placed in the same company and each student gets placed in exactly 1 company of his preference. Hence, the answer is o P! 1 3. No of Ways Students Get Placed ALL This is the placement season for IT campus. In total companies (1 to X) are visiting the campus. There are total N students who are appearing for interviews. Each student has his/her preference list of companies for which he wants to appear in the interview. Your task is to find out number of ways the students gets placed such that following conditions are satisfied 5 7 8 . Each student gets job from his/her preference list. No two students gets placed in the same company Each student gets exactly one job 10 11 12 13 14 15 15 17 18 19 20 21 22 TUTTE Input Format First line contains x the number of companies visiting the campus Next line contains the number of students. The subsequent N lines contains the list of preferred companies of the students. For each student (23-1/" line contains the size of his preference list while 2fline contains the space separated integers representing the preferred companies for student. Note : Students can put same company multiple times in their preference list. Constraints IX20 . IN 10 . 1 X where I sis Xand size, is the size of the preference list of the companies of the student Output Format Print the total number of ways students gets placed based on the conditions specified. Output the number modulo non # Sample input 1 ALL Sample Output 1 1 Sample Input 2 2 . 1234 2 35 Sample Output 2 Tere Sample Output 2 ALL Sample Inputs 5 le 5 5 5 225 5111 231 2 353 2113 Sample Output 3 ALL Explanation Sample Case x-5N-2 The preference list of 2 students is 4 4 3 2 Students can get job in only 7 way such that no 2 students get placed in the same company and each student gets placed in exactly 1 company of his preference. Sample Case 2 X=5, N=2 The preference list of 2 students is 1 2 3 4 35 Students can get job in only 7 ways such that no 2 students get placed in the same company and each student gets placed in exactly 1 company of his preference. 13 1 5 2 3 25 H C 1 2 3 4 ALL Students can get job in only 7 ways such that no 2 students get placed in the same company and each student gets placed in exactly 1 company of his preference. 13 15 23 25 35 4 3 4 5 2 Sample Case 3 X = 5, N=10 The preference list of 10 students is 5 3 3 5 3 5 2 2 3 11 3 3 5 5 1 2 2 4 3 5 5 2 1 2 3 2 2 5 2 2 5 1 1 1 1 2 3 4 1 1 2 3 5 3 5 211 3 2 There is no way we can allocate jobs to students such that no 2 students get placed in the same company and each student gets placed in exactly 1 company of his preference. Hence, the answer is o P
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
