Problem

Source: ISL 2023 C2

Tags: combinatorics



Determine the maximal length $L$ of a sequence $a_1,\dots,a_L$ of positive integers satisfying both the following properties: every term in the sequence is less than or equal to $2^{2023}$, and there does not exist a consecutive subsequence $a_i,a_{i+1},\dots,a_j$ (where $1\le i\le j\le L$) with a choice of signs $s_i,s_{i+1},\dots,s_j\in\{1,-1\}$ for which \[s_ia_i+s_{i+1}a_{i+1}+\dots+s_ja_j=0.\]