Desni klik
의견: 0
NFP \(is\) the future!, this is something all Noa’s friends can expect him to say when
finance topics come up.
NFP is one of the cryptocurrencies. The value of NFP over the course of \(s\) days
can be represented with a matrix with \(r\) rows and \(s\) columns, consisting only
of characters . and #. The character # in the \(i-th\) column represents the value
of NFP on the \(i-th\) day, with the value being the number of the row, counted
bott\(om-up\).
....##.
..#...
.##....
......#
The value \(of\) NFP from the second example over the course \(of\) 7 days was: 3, 2, 2, 3, 4, 4, 1.
The insecurity \(of\) this NFP \(is\) 3.
The insecurity of NFP is defined as the difference between the maximum and minimum value it achieves
over the course of \(s\) days.
Noa wants to determine the insecurity for \(n\) NFPs, whose values are represented by matrices with \(r\) rows
and \(s\) columns.
Help him determine the insecurity of each of the \(n\) NFPs.
Subtask 1 (5 points): \(r = s = 2\)
Subtask 2 (15 points): \(n = 1\)
Subtask 3 (30 points): No additional constraints.
The first line contains integers \(n\), \(r\) and \(s\) (\(1 \le n \le 20\), \(2 \le r\), \(s \le 50\)), the number of NFPs, and the
number of rows and colums of the matrices.
\(n\) matrices follows, one below another, each with \(r\) rows and \(s\) columns, representing NFP values. Each
column consists only of characters ., except for exactly one character #.
Print \(n\) lines. In the \(i-th\) of \(n\) lines print the insecurity od the \(i-th\) NFP.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
1 | 5점 | \(r = s = 2\) |
2 | 15점 | \(n = 1\) |
3 | 30점 | No additional constraints. |
4 2 2
##
..
..
##
#.
.#
.#
#.0
0
1
11 5 8
.....#.#
...#..#.
..#.#...
.#......
#.......42 3 3
...
##.
..#
.#.
#..
..#1
2
Note: For clarity’s sake, in the examples there are blank lines between matrices. In the test cases there
will not be blank lines between matrices.Clarification of the first example:
The values of the first and the second NFP do not change over the days, so their insecurities are equal to
0. The value of the third NFP decreases by 1 on the second day, so the insecurity is equal to 1. The value
of the fourth NFP increases by 1 on the second day, so the insecurity is equal to 1.
Clarification of the second example:
The maximum value NFP has is 5 (on days 6 and 8), and the minimum value is 1 (on day 1). Therefore,
the insecurity is equal to 5 −1 = 4.
평가 및 의견
Desni klik
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Desni klik