P2241 Counting Squares (Enhanced Testdata Version)

Background

1997 Junior Problem 1.

Description

Given an $n \times m$ grid board, compute how many squares and how many rectangles (excluding squares) it contains.

Input Format

One line: two positive integers $n,m$ ($n \leq 5000,m \leq 5000$).

Output Format

One line: two positive integers, the numbers of squares and rectangles (excluding squares) in the grid, respectively.

Explanation/Hint

Translated by ChatGPT 5