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?
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
please add solutions…
Solutions are not opening, check the links please
it’s ok now
very well written
Very nice explanation
hey.
i edited the link.
same situ though.
thanks anyways.
The concept is quite nice. I tried to implement exactly the same thing in code. However, I did not know about the container, and hence my solution became very complicated.
Why are you removing both 2’s??It’s a multi-set, so only one instance of 2 will be removed and then it will become {2,3,3,4}.
May you please tell me how you got 0 0 1 1 1 1 2 2 by adding the elements of subsets of set={0,1,0} in your given test case as the possible subsets are {},{0},{1},{0,1},{1,0},{0},{0,1,0},{0,0} and the array formed is 0 0 1 1 1 0 1 0.Correct me if I am wrong.
nope…u havent!!!