i tried to sorted the input array in descending order and then subtract elements in 1 to n from 0: input[i]-input[0]…this gives me the n required elements…please tell me what is wrong with this approach
What if we sort the array in descending order and then subtract each element from i=1 to n from element at i=0…
each element = sorted_input[0]-sorted_input[i] from i=1 to i=n
For most of the test cases my code is working fine. I even checked for the end cases. But it is giving wrong answer. Can someone please help me to find the problem in the code or just provide some cases for which my code is not working. Any help is greatly appreciated.
can anybody explain me the time complexity part …why log(2^n)is multiplied with 2^n?
thank you
I approach the problem with the similar idea to the solution but I’m getting WA.Can anyone please help me?
@rishavz_sagar 0,1,0 is the wrong answer for input 0 0 1 1 1 1 2 2. I gave a testcase for which code was returning wrong answer.
here in PREREQUISITES it says heap… what is the use of heap here ??
Please check my solution. I have implemented the editorial but getting WA.
https://www.codechef.com/viewsolution/19759343