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

19740번 - How Many Tests 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB236837636.190%

문제

When judges prepare tests for the programming contest problem, they number tests from 1ドル$ to $n$.

It is convenient if the files with tests are shown in their correct order, from 1ドル$ to $n$. But file managers sort files by their names as strings, so if the name of the test file is equal to its number, the file order is not correct, for example <<10>> goes before <<2>>.

To avoid such problem, file names are prepended with leading zeroes. Judges use minimal possible number of leading zeroes to make names of all files have the same length. For example, if the problem has 10ドル$ tests, the names of the files with tests are <<01>>, <<02>>, <<03>>, <<04>>, <<05>>, <<06>>, <<07>>, <<08>>, <<09>> and <<10>>.

Andrew is an experienced judge, so he always uses the described way to name the files with tests. Recently he has found some files with tests of some ancient problem at his old hard drive. Unfortunately, the drive is damaged, so some tests are missing. Help Andrew to find out how many tests could be there in the problem. He wants to know the minimal and the maximal possible number of tests.

입력

The first line of input contains an integer $k$ --- the number of files (1ドル \le k \le 1000$). The following $k$ lines contain file names. All these lines are non-empty, have equal length that doesn't exceed 9ドル$. File names are distinct, they only contain digits. No file name contains only zeroes.

출력

Output two integers: the minimal and the maximal number of tests that the problem could have.

제한

예제 입력 1

3
05
10
08

예제 출력 1

10
99

힌트

출처

Olympiad > Russian Olympiad in Informatics > Russia High School Programming Contest > Russia High School Programming Contest 2018 L번

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

출처

대학교 대회

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

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