Problem

Source: Czech-Polish-Slovak Match 2017 day 1 P3

Tags: winning positions, game strategy, Sequence, divisible, number theory



Let ${k}$ be a fixed positive integer. A finite sequence of integers ${x_1,x_2, ..., x_n}$ is written on a blackboard. Pepa and Geoff are playing a game that proceeds in rounds as follows. - In each round, Pepa first partitions the sequence that is currently on the blackboard into two or more contiguous subsequences (that is, consisting of numbers appearing consecutively). However, if the number of these subsequences is larger than ${2}$, then the sum of numbers in each of them has to be divisible by ${k}$. - Then Geoff selects one of the subsequences that Pepa has formed and wipes all the other subsequences from the blackboard. The game finishes once there is only one number left on the board. Prove that Pepa may choose his moves so that independently of the moves of Geoff, the game finishes after at most ${3k}$ rounds. (Poland)