can anyone help me how to solve it?

Since the value of p<=1e10, and 2^34 is approximately equal to 10^10. Hence we are only concerned about the first 35 elements of array b, i.e whether the sum p is possible with the first 35 elements of array b. This can easily be done using meet-in-the-middle algorithm, i.e divide 35 elements into two halves. Find all possible sums in each half and for each sum in the first half check if (p-sum) is present in the second half using map. That’s it.

1 Like

oh thanks

2 questions to be solved in 2 hours?

1 Like

yes

Heyy, did you hear from them?