A $\pm 1$-sequence is a sequence of $2022$ numbers $a_1, \ldots, a_{2022},$ each equal to either $+1$ or $-1$. Determine the largest $C$ so that, for any $\pm 1$-sequence, there exists an integer $k$ and indices $1 \le t_1 < \ldots < t_k \le 2022$ so that $t_{i+1} - t_i \le 2$ for all $i$, and $$\left| \sum_{i = 1}^{k} a_{t_i} \right| \ge C.$$
Problem
Source: ISL 2022/C1
Tags: combinatorics, Integer sequence, ISL 2022
09.07.2023 08:35
09.07.2023 08:47
The solution might be flawed but I would post it here
edit: I wrote the solution with the statement @below
09.07.2023 08:50
For context, this problem appeared during the US IMO Training Camp with the following flavor text: MOP Test 4 wrote: There are $2022$ buckets of water arranged in a row, each colored red or blue. Sally the salmon plays the following game: 1. First, she chooses any bucket to start in and begins to jump. 2. At each step, she may jump to the next bucket, or the one after that. 3. She may stop jumping at any point, ending the game. After the game ends, her score is the absolute value of the difference between the number of red buckets and the number of blue buckets she visited. Find the largest possible score Sally can achieve, regardless of the colors of the buckets.
09.07.2023 10:34
09.07.2023 23:53
The answer is $\boxed{506}$, achieved by $+--++--+...+--++-$. If you really want a proof for why this gives $506$ use dp or something. To prove that $506$ is the lowest you can get, consider the following algorithm: Start at the first $+$, then go through every $+$ and go through every other $-$ in a gap(so say if we have $++---+++$ we go through indices $1,2,4,6,7,8$). The algorithm where you swap $+$ and $-$ is the other algorithm we will consider. In both cases, we go through at most half of each gap, so we can just consider what happens if we go through half of the other sign. Let $x$ be the number of $+$s, so there are $2022-x$ $-$s. Then we must have \[C\le \text{max}\left(x-\frac{2022-x}{2},2022-x-\frac{x}{2}\right) = \text{max}\left(\frac{3x-2022}{2},\frac{4044-3x}{2}\right).\]This is the maximum of two numbers that sum up to $1011$, so it must be at least $505.5$, so it must be at least $506$. $\blacksquare$
11.07.2023 00:36
Solved with OronSH. The answer is $\boxed{506}$. The construction is $1, -1, -1, 1, 1, -1, -1, 1, \ldots, 1, -1, -1, 1, 1, -1$, where $1, -1, -1, 1$ is repeated $505$ times and $1, -1$ is added to it. Notice the maximal sum we can get in each block of $1,-1,-1,1$ is $1$, and the maximal sum we can get in $1,-1$ is $1$, so we have a maximal value of $505\cdot 1 + 1 = 506$. Similarly, the minimal sum we can get in $-1,1,1,-1$ is $-1$, and the minimal sum we can get in $1,-1$ is $-1$, so we have a minimal value of $(-1) + -1 \cdot 505 = -506$, as desired. Now we show that we can always create a subsequence as in the problem with absolute value at least $506$. WLOG that there are at least $1011$ ones. Let $A$ be the number of ones and $B$ be the number of negative ones in total. The idea is to select every single $1$, and the every second element in each string of $-1$'s. This selection satisfies $t_{i+1} - t_i \le 2$. This gives us a total of at least $A - B/2 \ge 1011 - 1011/2 = 505.5$. Since it must be an integer, it is at least $506$.
11.07.2023 01:43
WLOG, we can assume that we have an equal or greater number of $1$ than $-1$ (since we are considering the sum in terms of absolute value). Let's consider the "blocks" of $-1$. Let's say that in the first "block" we have $n_1$ numbers $-1$, in the second "block" we have $n_2$, ..., and in the $k$-th block, we have $n_k$ numbers $-1$: $$\dots \underbrace{-1,-1,-1,\dots,-1}_{n_1}, 1,1,1, \dots, 1, \underbrace{-1,-1,-1,\dots,-1}_{n_2},1,1,1, \dots,1, \underbrace{-1,-1,-1,\dots,-1}_{n_k}, \dots$$In a block of $x$ number $-1$, we have to take at least $\left \lfloor{\frac{x}{2}}\right \rfloor$ numbers. Therefore, sum of $-1$ is at most $$\left \lfloor{\frac{n_1}{2}}\right \rfloor+\left \lfloor{\frac{n_2}{2}}\right \rfloor+\dots+\left \lfloor{\frac{n_k}{2}}\right \rfloor\leqslant \left \lfloor{\frac{n_1+n_2+\dots+n_k}{2}}\right \rfloor=\left \lfloor{\frac{1011}{2}}\right \rfloor=505\text{.}$$So for every $\pm 1$-sequence, we can achieve sum $1011-505=506$. ($1011$ because we have at least 1011 number $1$) Construction for $506$: $\underbrace{1, -1, -1, 1}{}, \underbrace{1, -1, -1, 1}{}, \dots, \underbrace{1, -1, -1, 1}, 1, -1$.
14.07.2023 17:42
The answer is $506$, with equality achieved using 505 copies of $1,-1,-1,1$ and then a $1,-1$ at the end. To show this achieves it, consider each block of 4 (plus one block of 2), we can get at most one from each of these and it follows easily. Let there be at most as many $-1$s as $1$s, then take as little $-1$'s as you can to take all the $+1$s. Let $c(1),c(-1)$ denote the number of 1s and -1s respectively. For each block of $x$ negatives, we need to take at least $\left\lfloor \frac x2 \right\rfloor$ of them. Then the problem follows since \[ c(1) - \sum_{\text{block of } x} \left\lfloor \frac x2 \right\rfloor \geq 1011 - \left\lfloor \frac{1011}{2} \right\rfloor = 506, \]as desired.
14.07.2023 20:05
14.07.2023 21:50
Solved with pi271828. The answer is $506$. Let $S$ denote the sum in question; we seek the minimum of $\max(|S|)$ over all sequences $a_1,\dots,a_{2022}$. Optimality. Consider the sequence $1,-1,-1,1,1,\dots,1,1,-1$, and specifically the middle $2020$ terms; by symmetry, we can maximize the raw value of $S$ (rather than minimizing it and so maximizing its absolute value). If only one of the two terms $a_{4n-1},a_{4n}=1$ are among the chosen $a_{t_1},\dots,a_{t_k}$, we can include the other of the two whilst preserving all conditions and incrementing $S$. Additionally, for any "block" $-1,-1,1,1$ adjacent to but not among the chosen terms, we can include the terms $-1,1,1$ whilst preserving conditions and incrementing $|S|$. Including $a_1=1$, we therefore have the "steady state" \[S\le1-1+1+1-1+1+1-\dots-1+1+1=506,\]as claimed. Sufficiency. For any sequence, let $r_1,\dots,r_m$ denote the lengths of contiguous blocks of consecutive $-1$'s, and define $b_1,\dots,b_n$ similarly. To maximize the magnitude of $S$ in the negative direction, we include all the $-1$'s from $r_1,\dots,r_m$, and "bridge" these disjoint blocks with every other $1$, of which there are $\textstyle\sum\lfloor\tfrac{b_i}{2}\rfloor$. Analogously, to maximize the magnitude of $S$ in the positive direction, we include all the $1$'s from $b_1,\dots,b_n$ and bridge with every other $-1$, of which there are $\textstyle\sum\lfloor\tfrac{r_i}{2}\rfloor$. Hence, \[|S|_1=\sum_{i=1}^mr_i-\sum_{i=1}^n\left\lfloor\frac{b_i}{2}\right\rfloor\quad\text{and}\quad|S|_2=\sum_{i=1}^nb_i-\sum_{i=1}^m\left\lfloor\frac{r_i}{2}\right\rfloor\]are both attainable. Summing, we have \[|S|_1+|S|_2=\left(\sum_{i=1}^mr_i+\sum_{i=1}^nb_i\right)-\left(\sum_{i=1}^n\left\lfloor\frac{b_i}{2}\right\rfloor+\sum_{i=1}^m\left\lfloor\frac{r_i}{2}\right\rfloor\right)\ge2022-1011=1011,\]whence one of $|S|_1,|S|_2$ are $\ge506$, as desired. $\square$
19.07.2023 19:30
We claim the answer $C=506.$ By a straightforward check the exact bound is obtained for the sequence $$+1,-1,-1,+1,+1,-1,-1,\ldots ,+1,+1,-1.$$ Now let's prove that such a sum is attainable for an arbitrary sequence. Divide the sequence in ascending order of index by consecutive blocks of equal numbers, and let these blocks contain $x_1,y_1,x_2,y_2,\ldots ,x_n,y_n$ numbers respectively ($x_i$ belongs to the block of $+1;$ probably $x_1$ or $y_n$ equal to $0$). Multiplying each number by $-1$ doesn't change the condition, so WLOG $\sum_{i=1}^n y_i\leq 1011.$ As a strategy lets pick all $+1,$ and in each block of $-1$ pick all numbers with even positions in this block - the sum of picked elements is $\sum_{i=1}^n \left( x_i-\left\lfloor \frac{y_i}{2}\right\rfloor \right) \geq 2022-\sum_{i=1}^n y_i -\left\lfloor \sum_{i=1}^n \frac{y_i}{2} \right\rfloor \geq 2022-1011-505=506.$
30.07.2023 06:02
ike.chen wrote: A $\pm 1$-sequence is a sequence of $2022$ numbers $a_1, \ldots, a_{2022},$ each equal to either $+1$ or $-1$. Determine the largest $C$ so that, for any $\pm 1$-sequence, there exists an integer $k$ and indices $1 \le t_1 < \ldots < t_k \le 2022$ so that $t_{i+1} - t_i \le 2$ for all $i$, and $$\left| \sum_{i+1}^{k} a_{t_i} \right| \ge C.$$ isn't it supposed to be $i=1$ instead of $i+1$ in the sigma notation? \[\left| \sum_{i=1}^{k} a_{t_i} \right| \geqslant C.\]
Attachments:

03.08.2023 06:49
The answer is $506$ with construction is $+,-,-,+$ $505$ times and $+,-$ in addition. In each $+,-,-,+$ and $-,+,+,-$ we can get at most $1$ in absolute value so the construction works. $~$ Now to show the bound, suppose WLOG there are at least $1011$ $+$. Select all the $+$, and every other $-$ then it's easy to show that we have at least $506$.
09.08.2023 21:40
Answer $506$ from taking $-1, 1, 1, -1, -1, 1, 1, \ldots$. To prove notice that we can process each block of consecutive $+1$ or $-1$ so that if $x, y$ are the number of $+1, -1$ total then we have on a fixed sequence: $\max \text{LHS} \geq \max(x - y/2, y - x/2) \geq \frac{x+y}{4} = 505 \frac{1}{2}$, so $\max \text{LHS} \geq 506$. This constant is achieved by the construction via the same blocking logic so we are done.
20.12.2023 04:09
Assume there are $a$ of the $+1$ and $b$ of the $-1$. Then $a+b=2022$. Let's now try to find the worst possible configuration for a fixed $a$ and $b$. To maximize $C$, realize that we are limited by the number of $-1$ we can remove. Turns out when all the $-1$ are consecutive this is the worst possible (there are equivalent configurations, but calculations will be the same.) Analogously all the $1$s are consecutive. From this logic we've proven both (1) guaranteed maximums and minimums and (2) provided the construction, say, $1,1,1,\dots,-1,-1,-1$. Now realize that the maximum is $M=a-b+\left \lceil \frac{b}{2}\right \rceil$ and the minimum is $m=a-b-\left \lceil \frac{a}{2}\right \rceil$. \[M+(-m)=\left \lceil \frac{a}{2}\right \rceil + \left \lceil \frac{b}{2}\right \rceil\]which is equal to $1011$ when $a$ is even. When $a$ is odd it's equal to $1012$. So we can always get at least $506$ difference.
13.01.2024 13:32
18.01.2024 22:53
The answer is $\boxed{506}$. Construction is to take $1, -1, -1, 1$ repeatedly $505$ times and append $1, -1$. WLOG, suppose that there are at least $1011$ positive terms and at most $1011$ negative terms among the $a_i$. Break the sequence of $a_i$ into blocks of $1$s and $-1$s, so that the signs of the blocks alternate. If we let $x_1$, $x_2$, ... denote the sequence of negative block sizes, then the number of negative terms in the subsequence $a_{t_i}$ is at most \[ \sum \left\lfloor x_i/2 \right\rfloor \le \left\lfloor (x_1+x_2+\dots)/2 \right\rfloor \le 505, \]so adding in all of the positive terms yields that $C \le 506$ always.
01.02.2024 03:02
07.02.2024 22:02
We will work the wording provided during the US IMO Training Camp. We claim that the answer is $\boxed{506}$. Upper Bound Proof. Consider the arrangement, \begin{align*} \text{RBBRRBB \dots RRB} \end{align*}Clearly it is optimal for Sally to begin on a ``block" of red buckets as if she begins on blue, she may just shift one ``block" back. Thus say she attempts to maximize $\text{Red} - \text{Blue}$. It is clear that in any block of four buckets, Sally can achieve a score of at most $+1$. As there are at most $506$ such sets, Sally can guarantee a score of at most $506$. $\square$ Lower Bound Proof. To show that Sally can always guarantee a score of $506$ take a random sequence. Assume that there are at most $1011$ blue buckets and at least $1011$ red buckets. Then say that there are ``blocks" of red buckets $r_1$, $r_2$, \dots, $r_x$ and blocks of blue buckets $b_1$, $b_2$, \dots $b_{x-1}$. Then the problem becomes the following. Pick an initial block $r_i$ to begin at, and a block $r_j$ to end at. Define the function $S(i, j) = \sum_{m=i}^j r_m - \sum_{m=i}^{j-1} \left\lfloor \frac{b_m}{2} \right\rfloor$ Maximize $S(a, b)$. Note that we may bound, \begin{align*} \sum_{m = i}^{j-1} \left\lfloor \frac{b_m}{2} \right\rfloor \leq \left\lfloor \frac{\sum_{m=1}^{x-1} b_m}{2} \right\rfloor \leq \left\lfloor \frac{1011}{2} \right\rfloor = 505 \end{align*}Then we guarantee at least, \begin{align*} S(1, x) \geq \sum_{m=1}^{x} r_m - 505 \geq 1011 - 505 = 506 \end{align*}and hence we are done. $\square$
19.02.2024 23:58
The answer is $506$. Define $f(S, C)$ for subsequence $S$ and $C \in {1, -1}$ to be the sum of the lengths of consecutive subsequences of $C$ in subsequence $S$ minus the sum of the floors of half of the length of each consecutive subsequence of $-C$ in subsequence $S$. It is obvious that the problem is asking for the minimum value of the maximum value of $C$ over every subsequence of every possible $\pm 1$ sequence. Observe that if $x$ is the number of $1$s in a subsequence, and $y$ is the number of $-1$s in a subsequence, then $f(S, 1) \geq x - \frac{y}{2}$, and $f(S, -1) \geq y - \frac{x}{2}$. Adding the two, we obtain $f(S, 1) + f(S, -1) \geq \frac{x+y}{2}$, so one of the function values must be greater than or equal to $\frac{x+y}{4}$. In particular, if our subsequence is the entire sequence, we must have a function value greater than or equal to $506$. Now, we claim that the sequence $1, -1, -1, 1, 1, -1, -1, \ldots -1$ satisfies the conditions. Observe that both $f(S, 1)$ and $f(S, -1)$ are equal to $506$ when $S$ is the full sequence. The rest of the proof that this sequence works is just casework, and I will omit it because I am lazy.
28.04.2024 07:28
We claim the answer is $506$, which can be achieved by $505$ repetitions of $1,1,-1,-1$ followed by $1,-1$. For the bound, WLOG there are $a\le 1011$ negative ones. Then, in each consecutive group of negative ones we can eliminate at least half of them so there are at most $\lfloor a/2\rfloor$ negative ones left. Hence, the sum is at least $2022-a-\lfloor a/2\rfloor\ge 506$, as desired. $\square$
12.05.2024 01:32
The answer is $\boxed{506}$. Construction: WLOG assume that there are at least $1011$ $a_i$ equal to $1$. Then over each gap of $a$ consecutive $a_i$ equal to $-1$ we can choose all but $\lfloor\frac{a}{2}\rfloor$ of them. So there exists a sequence with at least $1011$ positive $a_i$ and at most $505$ negative $a_i$. Bound: Consider the sequence $1,-1,-1,1,1,\dots,-1,-1,1,1,-1$. Each middle gap is 'unavoidable' leading to the desired bound.
29.07.2024 00:44
Proof: We claim that the answer is $506$. Note that if we have more $-1$'s than $+1$'s, we can flip the signs of all the numbers without affecting the problem. For the upper bound, we just consider the sequence, $$+1 - 1 - 1 + 1 +1 -1 -1 \dots$$Now for the lower bound, suppose the number of $+1$'s in each block is $a_i$ from $a_1$ through $a_n$ and similarly the number of $-1$'s in each block is $b_i$ from $b_1$ through $b_m$. Our strategy will be to pick all the $+1$'s and pick as few $-1$'s as possible. For each block of $-1$ we will end up picking $\left \lfloor{\frac{b_i}{2}} \right \rfloor$ and thus, $$C \geq \sum_{i=1}^n a_i - \left(\sum_{i=1} \left \lfloor{\frac{b_i}{2}} \right \rfloor \right)$$$$C \geq \sum_{i=1}^n a_i - \left \lfloor {\frac{\sum_{i=1}^m b_i}{2}} \right \rfloor$$$$C \geq 1011 - 505 = 506$$
13.08.2024 22:50
The answer is $506$. For the construction take $$1,-1,-1,1,1,-1,-1,\dots,-1,-1,1,1,-1$$ Where the sequence $1,-1,-1,1$ is repeated $505$ times and at the end we add $1$ and $-1$. Now we show that we can always achieve $506$. Suppose that $1$ appears $a$ times and $-1$ appears $b$ times. Case 1. $a=b=1011$. Suppose the last number is negative and suppose the first one is positive (if it is not positive than just deleting the first negative numbers from the sequence gives a weaker problem). So consider the sequence $a_{1},a_{2},\dots,a_{2021}$. Now choose $t_i$ by this algorithm: Pick $t_{1}=1$. After this, if we have chosen $t_1,t_2,\dots,t_k$ and $a_{t_k+1} = 1$ pick $t_{k+1}=t_k+1$ and if $a_{t_k+1}=-1$ pick $t_{k+1}=t_k+2$. Notice that by doing this, we pick all the $1$s and skip at least $505$ of the $-1$s so the overall sum is at least $506$. Case 2. $a\neq b$. Suppose that $a > b$. We have that $a \ge 1012 > 1010 \ge b$ so by repeating the same algorithm from the start (without forgetting about the last number) we can choose every positive number and skip at least $\left\lfloor\frac{b}{2}\right\rfloor$ negative numbers so the sum will be at least $a-\left\lceil\frac{b}{2}\right\rceil\ge 1012-505=507$.
19.08.2024 21:56
2022 C1 Ex. Ex. the extreme version found here
16.09.2024 20:23
posting for storage
29.09.2024 04:05
I claim the answer is $506$. Construction with $506$ as maximal: $xxyyxxyyxxyy \cdots xxyyxy$, where $x$ represents $1$ and $y$ represents $-1$. The largest possible positive sum is accomplished when all positive elements are in the sequence, and we are forced to take $505$ negative elements since there are $505$ blocks of $2$ negative elements, this gives a sum of $1011 - 505 = 506$. Proof that we can always get $506$: Without loss of generality let there be at least as many positive elements as negative ones. Separate the sequence into blocks of positive and negative elements, we can take all the elements in positive blocks and we can ensure we take at most half of the elements in the negative blocks, so letting there be $x$ positive elements we can guarantee as a sum of at least $x - (\frac{2022 - x}{2}) = \frac 32 x - 1011$, since $x \ge 1011$ we have we can guarantee a sum at least $505.5$, since the sum is an integer we can guarantee $506$.
29.10.2024 04:22
Ps: For some reason, AOPS won't let me post the solution to this problem in English, so it will be in Portuguese. Primeiro, observe que a resposta é $\boxed{506}$ e pode ser facilmente obtida pelo seguinte padrão: $$+--++--++--++...--++-$$ Agora, para provar o limite, vamos supor, SPG, que a quantidade de $a_i=+1$ é $\ge a_j=-1$ Seja $X_i$ o $i$-ésimo bloco composto de $x_i$ $a_j=+1$ e $Y_i$ o $i$-ésimo bloco composto de $y_i$ $a_j=-1$ Observe que para cada $\pm1$-sequência, podemos executar o seguinte algoritmo para obter $\sum_{i = 1}^{k} a_{t_i} \ge 506.$ Tome $(t_1, t_2, ..., t_{x_1})=X_1$ e $(t_{x_1+1}, t_{x_1+2}, ..., t_{x_1+\left \lfloor{\frac{y_1}{2}}\right \rfloor})$ alternadamente entre os termos de $Y_1$ começando com $t_{x_1+1}=a_{x_1+2}$. Mais especificamente, para cada $X_i$, tome todos os seus termos como elementos do conjunto ${a_{t_1}, a_{t_2}, ..., a_{t_k}}$ e, para cada $Y_i$, tome alternadamente seus valores como termos desse conjunto. Portanto, veja que isso pode ser feito já que a maior distância entre dois $t_i$s é $2$. Além disso, com este algoritmo, garantimos que: $$\sum_{i = 1}^{k} a_{t_i} \ge \sum_i x_i + \sum_i {\left \lfloor{\frac{y_i}{2}}\right \rfloor} \ge 1011-505=506$$Como queríamos mostrar.
17.11.2024 18:13
is $t_{k+1}= t_1$?
28.12.2024 01:32
The answer is $C = 506$. For a construction, take the sequence $+1, +1, \ldots, +1, -1, \ldots, -1$, consisting of $1011$ terms of $+1$ followed by $1011$ terms of $-1$. To prove bound holds, suppose WLOG there are more terms which are $+1$ than $-1$. Let $x$ be the number of terms which are $+1$. Now, suppose that whenever we come across a run of consecutive $-1$s, we only take the second term in the run to be one of the $a_{t_i}$, and then the fourth term, and so on. Then at most $\lfloor \tfrac{2022 - x}{2}\rfloor$ of the $a_{t_i}$ will be $-1$, so the sum of $a_{t_i}$ across all $1 \le i \le k$ is at least $x - \lfloor \tfrac{2022 - x}{2}\rfloor$. Since $x \ge 1011$ we have $\lfloor \tfrac{2022 - x}{2}\rfloor \le \tfrac{2022 - 1011}{2} = 505$, so $x - \lfloor \tfrac{2022 - x}{2}\rfloor \ge 1011 - 505 = 506.$
01.01.2025 11:27
Warning: Super long writeup.
03.01.2025 16:54