Stick Difference
You are given n sticks with lengths a_1,a_2,\dots,a_n. You must make exactly k cuts to the sticks, so that the number of sticks becomes n + k. After making the cuts, the difference between the length of the longest and shortest sticks should be as small as possible. Your task is to compute the smallest possible difference for all amounts k=1,2,\dots,m. The cuts must keep the lengths of the stick
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