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

17187번 - Necklace 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB70252255.000%

문제

Jill and Jane are sisters. Last Christmas each of them got a string consisting of colorful beads. We can describe each color as a letter of the English alphabet (“a”. . . “z”), and each string of beads as a word.

The girls would like to create necklaces from their strings. They can turn each string into a necklace by removing some (possibly zero) beads from the ends, and then connecting the ends of the remaining part of the string. The resulting necklace can be rotated and turned over.

The sisters want their necklaces to look exactly the same, and also be as long as possible. What is the maximum length they could achieve?

입력

The first and the second line each contain a non-empty sequence consisting of no more than N lowercase characters, the descriptions of Jill’s and Jane’s strings respectively.

출력

The first line should contain a single positive integer: the maximum number of beads each girl’s necklace can have in the end. It is guaranteed that a positive length can be achieved.

The second line should contain two integers: the starting positions of the necklaces in Jill’s and Jane’s string respectively. If there are several possibilities, output any one of them. The positions are numbered left to right starting from 0.

제한

서브태스크

번호배점제한
125

N = 100.

220

N = 400.

340

N = 3000.

예제 입력 1

zxyabcd
yxbadctz

예제 출력 1

4
3 2

We can do as follows:

“zxyabcd” → “---abcd”
“yxbadctz” → “--badc--”

The strings “abcd” and “badc” result in identical necklaces.

힌트

출처

Olympiad > Baltic Olympiad in Informatics > BOI 2019 E번

채점 및 기타 정보

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

출처

대학교 대회

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

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