MathLabs

Problem 4

Let nn be a fixed positive odd integer. Take m+2m+2 distinct points P0,P1,…,Pm+1P_0,P_1,\ldots,P_{m+1} in the coordinate plane such that: (1) P0=(0,1)P_0=(0,1), Pm+1=(n+1,n)P_{m+1}=(n+1,n), and for 1≤i≤m1\le i\le m, both coordinates of PiP_i are integers between 11 and nn inclusive; (2) for 0≤i≤m0\le i\le m, segment PiPi+1P_iP_{i+1} is parallel to the xx-axis if ii is even and to the yy-axis if ii is odd; (3) for 0≤i<j≤m0\le i<j\le m, segments PiPi+1P_iP_{i+1} and PjPj+1P_jP_{j+1} share at most one point. Determine the maximum possible value of mm.
Step 5 of 5: Count and conclude
m=n(n−1)m=n(n-1)
Detailed analysis

The inner path contributes (n−4)(n−5)(n-4)(n-5) turning points and the surrounding frame contributes n2−(n−4)2−4n^2-(n-4)^2-4; their sum is n(n−1)n(n-1). Combined with the upper bound, this proves the maximum.