← All problemsSign in

Keeping Fit

Fluffy the squirrel is having a workout to keep his body fit. He arrives at a country with n cities arranged in a circle. There is a uni-directional road connecting city i and city i + 1 for all 1 ≤ i ≤ n - 1, with length li kilometres and also there is a road connecting city n and city 1, with length ln kilometres. Fluffy starts at city 1. Every day, he can run at most x kilometres. However, stay

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start