#P2180. 摆石子

    ID: 1114 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>动态规划,dp数学计算几何洛谷原创

摆石子

Description

In a grid formed by NN horizontal lines and MM vertical lines (KK's self-made coordinate system), KK places KK stones, each stone only allowed to be placed at an intersection point of the grid.

Now KK wants to know, under the optimal placement, the maximum number of rectangles whose sides are parallel to the coordinate axes, and he requires that each of the four vertices of such a rectangle has exactly one stone placed on it.

Input Format

One line with three integers N,M,KN, M, K.

Output Format

Output one integer on a single line, representing the maximum number of rectangles that meet the requirement.

3 3 8
5

Hint

Constraints:

  • For 50%50\% of the testdata, N,M30N, M \le 30.
  • For 100%100\% of the testdata, 1N,M3×1041 \le N, M \le 3 \times 10^4, 0KN×M0 \le K \le N \times M.

Translated by ChatGPT 5