Problem #358
Diagonal Dominance
You are given an n \times n matrix filled with the numbers 1, 2, 3, \ldots, n^2. The matrix is arranged such that every row (from left to right) and every column (from top to bottom) is sorted in strictly increasing order. Let a_{ij} denote the number at the intersection of the i-th row and j-th column.
For each i where 1 \leq i \leq n, define b_i as the number of distinct entries that can appear in the diagonal position a_{ii}. Your task is to find the sum b_1 + b_2 + \cdots + b_n for n = 1000.