Yes, I tried that proof. When searching for appropriate subset, why does popping minimum element in array B work ?
You want fit in as many balls in a bag of weight W. What do you chose? Lighter balls or heavy balls? We only have to maximise number of balls in bag.
Then apply the logic to current scenario. Thanks @tihorsharma123 for helping me
complexity O(nlogn)
Nice Approach @tihorsharma… got Ac in java
https://www.codechef.com/viewsolution/18943916
Thank you
i do agree with you that it would be so appreciable if setter has added comments in his code , that would make it lot easier.
All the test cases were maximal, so official cases wont help. I will try to add few more cases.
issue solved i was using int instead of long long .
Will inform him that his solution got hacked xD. Nice job. The setter’s solution (used to make TC) is correct. The idea is also correct, he made a minor bug in implementation, so no major problem. Thanks
Good job dear. Hope you liked the editorial