I thought of an alternative approach but got WA, it goes like this:

1.Find the largest positive number (i.e. village with most humans).

2.Find the nearest negative number (i.e. nearest dinosaur village).

3.Make appropriate movement of laddus and add the grass consumed.

Can anyone point out why this doesn’t work?