STICKY CARS
CodeChefOpen on judge ↗
You are given $N$ cars in a $1D$ plane. The initial coordinates of the cars are given as $X_1 ,X_2 …..,X_N$. At time t=0 sec all the cars start moving towards the right with velocities given as $V_1,V_2 ,V_3 ….V_N$. Your task is to find the total distance traveled by the cars untill time t=T. During this time if two cars collided with each other then the two cars stick together and move with th
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