#P9028. [COCI 2022/2023 #1] Desni klik
[COCI 2022/2023 #1] Desni klik
Background
NFP means the future. When it comes to finance, Noa’s friends all want to hear him say this.
Problem Description
NFP is a cryptocurrency. The value of one NFP over days can be represented by an -row, -column character matrix containing only the characters . and #. In column , the # in the -th row from bottom to top means that on day the value of this NFP is .
The “insecurity” of an NFP is defined as the difference between the maximum value it reaches and the minimum value it reaches over the days.
....##.
#..#...
.##....
......#
As shown above, the values of this NFP over days are: . Its “insecurity” is .
Now Noa wants you to help him determine the insecurity of the NFPs he has.
Input Format
The first line contains three integers , representing the number of NFPs, the number of rows of the matrix, and the number of columns.
Then follow matrices of size , describing the values of each NFP over days.
It is guaranteed that in the value matrix of each NFP, every column contains exactly one character #.
Output Format
Output lines, each being the insecurity of one NFP.
4 2 2
##
..
..
##
#.
.#
.#
#.
0
0
1
1
1 5 8
.....#.#
...#..#.
..#.#...
.#......
#.......
4
2 3 3
...
##.
..#
.#.
#..
..#
1
2
Hint
| Subtask | Score | Special Property |
|---|---|---|
| No special property |
For of the testdata, , .
The full score for this problem is points.
Translated by ChatGPT 5