P4858 [PA 2013] Karty
Description
Given an $n \times m$ rectangle, each cell is either `_` or `X`. Choose the largest possible $r \times c$ rectangle such that multiple $r \times c$ rectangles (overlapping is allowed) can cover all `X` cells, and do not cover any `_` cells.
Input Format
The first line contains $n, m$, as described above.
The next $n$ lines each contain a string of length $m$ describing the matrix.
Output Format
Output one line with two integers $r, c$, separated by a space.
If there are multiple choices with the maximum area, output the one with the smallest $r$.
Explanation/Hint
Constraints: for $100\%$ of the testdata, $1 \le n, m \le 2.5 \times 10^3$.
Translated by ChatGPT 5