Logo
(追記) (追記ここまで)

26392번 - Desni klik 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB31326021984.556%

문제

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 bottom-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.

입력

The first line contains integers n, r and s (1 ≤ n ≤ 20, 2 ≤ r, s ≤ 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.

제한

서브태스크

번호배점제한
15

r = s = 2

215

n = 1

330

No additional constraints.

예제 입력 1

4 2 2
##
..
..
##
#.
.#
.#
#.

예제 출력 1

0
0
1
1

예제 입력 2

1 5 8
.....#.#
...#..#.
..#.#...
.#......
#.......

예제 출력 2

4

예제 입력 3

2 3 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.

출처

Contest > Croatian Open Competition in Informatics > COCI 2022/2023 > Contest #1 1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /