Daily

Random

Practice set

Baltic Way 2021 · Problem 10

Combinatorics

John has a string of paper where nn real numbers ai∈[0,1]a_{i} \in[0,1], for all i∈{1,…,n}i \in\{1, \ldots, n\}, are written in a row. Show that for any given k<nk<n, he can cut the string of paper into kk non-empty pieces, between adjacent numbers, in such a way that the sum of the numbers on each piece does not differ from any other sum by more than 1 .

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

Games and strategies · Algorithms and processes · Induction and recursion

Solutions

Solution

Denote the sums on each piece by

S1=a1+a2+⋯+am1,S2=am1+1+am1+2+⋯+am2,⋮Sk=amk−1+1+⋯+amk.\begin{align*} S_1 &= a_1 + a_2 + \dots + a_{m_1}, \\ S_2 &= a_{m_1+1} + a_{m_1+2} + \dots + a_{m_2}, \\ \vdots \\ S_k &= a_{m_{k-1}+1} + \dots + a_{m_k}. \end{align*}

By abuse of notation SiS_i will both denote the set of numbers enclosed by cuts and its sum, the meaning of which must be determined by the context.

We will start the following algorithm. During this algorithm we will move some elements to the neighbouring piece and construct new sequence of pieces S∗=(S1∗,S2∗,…,Sk∗)S^* = (S_1^*, S_2^*, \dots, S_k^*). Empty pieces may appear.

(i) Find p≤kp \le k such that SpS_p is the piece with the maximum sum of elements.

(ii) If Sp≤min⁡(S1,…,Sk)+1S_p \le \min(S_1, \dots, S_k) + 1 we are done.

(iii) If Sp>min⁡(S1,…,Sk)+1S_p > \min(S_1, \dots, S_k) + 1, let SqS_q be the pieces with minimum sum of elements nearest to SpS_p (ties broken arbitrarily) and let ShS_h be the next pieces to SqS_q between SpS_p and SqS_q (it is non empty by the choice of SqS_q). Then either p<qp < q and then h=q−1h = q - 1 and we define S∗S^* by moving the last element from Sh=Sq−1S_h = S_{q-1} to SqS_q, or q<pq < p, and then h=q+1h = q + 1 and S∗S^* is obtained by moving the first element of Sh=Sq+1S_h = S_{q+1} to SqS_q. If p=hp = h then set S=S∗S = S^* and go to step (1). If p≠hp \ne h then set S=S∗S = S^* and proceed to step (2).

Note that in step (3) each number Si∗S_i^* is at most SpS_p and no new pieces with sum SpS_p is created. Indeed, Sh∗<Sh≤SpS_h^* < S_h \le S_p, and for some jj Sq∗=Sq+aj<SpS_q^* = S_q + a_j < S_p since aj∈[0,1]a_j \in [0, 1] and Sp>min⁡(S1,…,Sk)+1S_p > \min(S_1, \dots, S_k) + 1. It is clear also that max⁡(S1,…,Sk)\max(S_1, \dots, S_k) does not increase during the algorithm.

Note also that in step (3) the pieces ShS_h may become empty. Then, in the next iteration of the algorithm, q=hq = h will be chosen since min⁡(S1,…,Sk)=Sh=0\min(S_1, \dots, S_k) = S_h = 0 and in step (3) Sh∗S_h^* will become non empty (but one of its neighbours may become empty, etc.).

Claim. Step (3) is repeated at most knkn times with SpS_p being the same maximal pieces in S∗S^* and in SS.

Proof. Let sis_i be the number of elements in ii-th pieces. Then the number

∑i=1k∣i−p∣si\sum_{i=1}^{k} |i - p|s_i

takes positive integral values and is always less than knkn. It is clear that this number decreases during the algorithm.

Thus after at most knkn iteration of (3), the algorithm decreases the value of SpS_p and so goes to (1). Consequently it decreases either the number of pieces with maximal sums or max⁡(S1,…,Sk)\max(S_1, \dots, S_k). As there are only finitely many ways to split the sum onto pieces, the algorithm eventually terminates at (2). □\square

Contest context

Results from Baltic Way 2021

12 teams

Mean score
0.1 / 5
Scores of 4 or 5
0 / 12
Estonia
1 / 5

Score distribution

011
11
20
30
40
50
All team scores
TeamScore
St. Petersburg0 / 5
Estonia1 / 5
Germany0 / 5
Latvia0 / 5
Lithuania0 / 5
Poland0 / 5
Denmark0 / 5
Norway0 / 5
Finland0 / 5
Sweden0 / 5
Iceland0 / 5
Ireland0 / 5