CAKE-WALK
CodeChefOpen on judge ↗
There are $N$ vehicles on a road marked as $a1,a2,a3….aN.$ Speed of vehicles are $1, 2, 3....N$ respectively and adjacent vehicles are at distance $K$ from each other. At time t=0 the vehicles start moving towards each other in the following fashion : $a1$ moves towards $a2$ and $a2$ moves towards $a1$, $a3$ moves towards $a4$ and $a4$ move towards $a3$. If N is odd vehicle $aN$ will not move
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