A Very Expensive Ride
CodeChefOpen on judge ↗
You are travelling on a road with two lanes $A$ and $B$. You are initially at position $0$. You need to reach your home at position $N+1$. On each of the lane $A$ and $B$ there are $N$ tollbooths which comes in your way to home. The tollbooths are at positions $1,2,3.., N$. Cost of crossing $i_{th}$ tollbooth in lane $A$ and lane $B$ is $A_i$ and $B_i$ respectively. You want to reach your home by
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start