Help with explanation

prob: https://atcoder.jp/contests/abc156/tasks/abc156_c

editorial: https://img.atcoder.jp/abc156/editorial.pdf

Strictly speaking, when holding a meeting at coordinate x which can be represented as x =
R + d (d > 0) for example, the points of stamina that i-th person will spend is:
(Xi − (R + d))2 = ((R + d) − Xi)
2 = (R − Xi)
2 + d(R − Xi) + d
2
,
and since the second term of the rightmost hand side is non-negative and the third term is
positive, the points of stamina spent is strictly greater than when holding a meeting at coordinate
R. It is the same when holding a meeting at coordinate x such that x < L.

I’m not able to understand how they derived that equation among other things

Let L be the smallest and R be the largest of the coordinates in which a person lives. At this time,
You don’t have to think about holding a rally at coordinates x such that x <L or R <x. I mean
Even in such cases, the physical strength consumed to participate is less than when holding a rally at coordinates L or R.
Because it never gets smaller.
Strictly speaking, if you hold a rally at coordinates x, for example x = R + d (d> 0), the i-th person attends the rally.
The physical strength consumed to do (Xi − (R + d)) 2 = ((R + d) − Xi)
2 = (R − Xi)
2 + d (R − Xi) + d
2
Since the second term on the far right side is non-negative and the third term is positive, compared to when a rally is held at coordinate R,
It really consumes more physical strength. The same is true if you hold a rally at coordinates x such that x <L.
Based on this idea, reduce the number of coordinates that need to be examined as candidates for a meeting place to at most 100
Can be done. When one meeting place is fixed, the total physical strength consumed by N people is calculated as O (N) times.

I’m not able to understand what this is supposed to mean

See this will be your relation
image
In this second term on the far right side is d(R − Xi)
& second term on the far right side is (R − Xi)^2
This is what i think they mean.

understood that but what does the term being negative and positive have to do with the coordinates is not clear

This question is also not clear to me. Can’t say much about that. Try do dry run it you will get the intuition or you can post a new thread too. As far as i think we have to calculate cost for every value between x[0…n] and cost is given by (X[j] - i) * (X[j] - i) . So there’s the use of coordinate.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.