#P5953. [POI 2018] Różnorodność
[POI 2018] Różnorodność
Problem Description
Given a matrix with rows and columns, for every consecutive sub-square with both side lengths equal to , count the number of distinct values that appear inside it.
Input Format
The first line contains three positive integers . The next lines each contain positive integers , representing the value at each position in the matrix.
Output Format
Output one line with two integers and . Let denote the number of distinct values that appear in the square whose top-left corner is . Then is the maximum value of , and is the sum of all values of .
3 5 2
1 5 3 3 3
4 1 3 3 4
4 2 4 4 3
4 20
Hint
For of the testdata, , and .
Translated by ChatGPT 5