Given n and 2 arrays a[i] denoting the time taken to eat ith grape and and b[i] denoting the power gained by eating the ith grape repectively.

The total time to eat is T minutes.

You can eat one grape irrespective of how many minutes it needs in usual time during the Tth minute of consumption.

Find the max power that can be obtained in T minutes.

N<=3000

T<=3000

1<A[i],b[i]<=3000

sample tc:

n=2 T=60

a[i]={10,100}

b[i]={10,100}

output :

110

explanation: We can eat the 1 grape in first 10 miniutes.Then in the next 10 minute he can eat the second grape .

power=10+100=110.

tc:2

n=2 T=60

a[i]={100,100}

b[i]={100,100}

output :

100

Explanation: Only one grape can be consumed.After that T minutes get over…

plz explain how to solve this question…I think dp would be used here…but i am not sure…