Mathematics, Competitive Programming, Philosophy, Discrete Mathematics.
most 2*(m-1)=2*m-2. What can we say about the difference in number of repaintings and number of deaths for the last stroke? Case 1: If this difference is 2 (as in Figure 1), we know that at least 3 segments remain alive at the end. This implies that the number of deaths is at most m+1–3=m-2,