An aerospace test lab runs a wind tunnel calibration pass and records airspeed readings in non-decreasing order. The lab's drag-response model turns an airspeed x into a drag coefficient using drag(x) = ax^2 + bx + c, where a, b, and c are fixed calibration constants for this run. Apply the model to every recorded airspeed and report the resulting drag coefficients sorted in non-decreasing order.
Print n space-separated integers on one line: the drag coefficients drag(x_1), ..., drag(x_n), sorted in non-decreasing order.
Example 1
Input
4 -4 -2 2 4 1 3 5
Expected
3 9 15 33
Explanation
With a=1, b=3, c=5: drag(-4)=16-12+5=9, drag(-2)=4-6+5=3, drag(2)=4+6+5=15, drag(4)=16+12+5=33. Sorted ascending gives 3 9 15 33.
Example 2
Input
5 -3 -1 0 1 3 -1 0 0
Expected
-9 -9 -1 -1 0
Explanation
With a=-1, b=0, c=0, drag(x)=-x^2: drag(-3)=-9, drag(-1)=-1, drag(0)=0, drag(1)=-1, drag(3)=-9. Sorted ascending gives -9 -9 -1 -1 0.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →