Continue statement at line no 63

This continue statement will take me to next stop even when my desired condition of F >= v[x].first-prev is not satisfied. Continue statement will take me to next iteration (i.e… i = i+1), which will change my distance to be covered from prev to next stop. I think we should use a while loop until and unless we get desired amount of fuel to reach out next stop.
link to my code - https://ide.codingblocks.com/s/261565
please clarify my doubt.

You implemented it correctly but condition should be while(fuel < v[i].first-prev)
as you must add fuel only when it is insufficient to complete current journey.
also in line 63 take N instead of n.
ALso take care for p.empty() after popping otherwise it may lead to seg fault.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.