Code Together SOLUTIONS CMX1P01

Code Together SOLUTIONS CMX1P01

Laxmi Chit Fund is wanting to recruit assistants to infer a calculation which can apply the law of “Ek ka Double” on any information object. Since this will be a mind boggling task and the calculation should be determined inside 21 days, they are wanting to employ ITUS students. (ITUS, otherwise called International Talent of Ultimate Student is an amazingly thorough degree which must be acquired by not many at last gifted, very equipped understudies.) 

Anuradha, the task supervisor of Laxmi Chit Fund, is a numerically odd lady and accepts that any gathering will have the option to make the calculation just if that gathering is sufficiently fortunate. She has just made M bunches out of the N understudies who applied for the entry level position, and doled out a Project Guides having karma ≥2 for each Group. 

She characterizes the karma of a gathering as result of fates of the apparent multitude of understudies in that gathering, modulo the karma of Project Guide for that Group. Presently, she needs to boost the karma of each gathering. She can eliminate quite a few understudies (perhaps 0) from any Group to boost the karma of that gathering. Being eccentric, she won’t permit the eliminated understudies to do temporary position at Laxmi Chit Fund, additionally she won’t change the gathering of any understudy. At the end of the day, any understudy either works in the effectively alloted Group, or isn’t permitted to do temporary position. 

If you don’t mind help Anuradha to figure the greatest attainable karma for each Group. 



First line contains T the quantity of testcases. 

First line of each testcase contains two numbers N and M, the quantity of understudies and the quantity of Groups individually. 

Second line of testcase contains N space isolated whole numbers, ith of these indicates Gi, for example the Group to which the ith understudy has a place. (for 1≤i≤N) 

Third line of the testcase contains N space isolated whole numbers, ith of these indicates Li, for example the karma of ith understudy. (for 1≤i≤N) 

Fourth line of testcase contains M space isolated whole numbers, ith of these indicates LGi, for example the karma of the Guide of ith Group. (for 1≤i≤M) 



For each testcase, print a solitary line containing M space isolated whole numbers, ith whole number MLi ought to mean the most extreme karma of ith Group. 









Each Group has in any event 1 part 

Each Group has all things considered 16 individuals 


Test Input 

5 3 

1 2 1 3 

7 8 2 15 1 

14 19 8 

2 1 

3 6 


Test Output 

7 8 7 



Testcase 1: 

For Group 1, for example {1,3}, most extreme karma can be accomplished by barring the third understudy, presently the Group becomes {1}, and has karma =7mod14=7. 

For Group 2, for example {2}, most extreme karma is 8, since 8mod19=8. 

For Group 3, for example {4,5}, one potential approach to expand karma is to keep the Group unaltered, for example 15∗1mod8=7, this is the most extreme reachable karma. 

Testcase 2: Excluding second understudy gives most extreme karma.


March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS


Related :

Related :

Leave a Comment

10 + 15 =