supercup_dtu_

can anyone explain…how to do this question…CodeChef: Practical coding for everyone
or what this guy did in his code…CodeChef: Practical coding for everyone

1 Like

the upper limit of n wasn’t too big n<=40.

so we can divide the array in 2 equal parts.(n1=n/2,n2=n-n1)

now we can calculate sum of all possible subset bcz 2^20~10^5

and then combine(by binary search or whatever u can do in timelimit) these two array to get required ans.