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

32789번 - Champernowne Subsequence 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB33272379.310%

문제

The $k^{\text{th}}$ Champernowne word is obtained by writing down the first $k$ positive integers and concatenating them together. For example, the 10ドル^{\text{th}}$ Champernowne word is 12345678910ドル$.

It can be proven that, for any finite string of digits, there exists some integer $k$ such that the finite string of digits will appear as a subsequence in the $k^{\text{th}}$ Champernowne word.

String $s$ is a subsequence of string $t$ if it is possible to delete some (possibly zero) characters from $t$ to get $s$.

Given a string of digits, compute the smallest integer $k$ such that the given string of digits is a subsequence of the $k^{\text{th}}$ Champernowne word.

입력

The first line of input contains a single integer $n$ $(1 \leq n \leq 10^5),ドル the length of the string of digits.

The second line of input contains a string of $n$ digits.

출력

Output a single integer $k,ドル the minimum integer such that the given string is a subsequence of the $k^{\text{th}}$ Champernowne word.

제한

예제 입력 1

2
90

예제 출력 1

10

예제 입력 2

2
00

예제 출력 2

20

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2024 ICPC Pacific Northwest Regional > Division 1 C번

ICPC > Regionals > North America > Pacific Northwest Regional > 2024 ICPC Pacific Northwest Regional > Division 2 H번

  • 문제를 만든 사람: Nick Wu
(追記) (追記ここまで)

출처

대학교 대회

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

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