Problem

Source: Serbia NMO 2010 problem 1

Tags: inequalities, floor function, combinatorics



Some of $n$ towns are connected by two-way airlines. There are $m$ airlines in total. For $i = 1, 2, \cdots, n$, let $d_i$ be the number of airlines going from town $i$. If $1\le d_i \le 2010$ for each $i = 1, 2,\cdots, 2010$, prove that \[\displaystyle\sum_{i=1}^n d_i^2\le 4022m- 2010n\] Find all $n$ for which equality can be attained. Proposed by Aleksandar Ilic