Duplicated Binary Strings

시간 제한1초메모리 제한2048 MB

요약
이진 문자열 S가 주어질 때, 길이가 짝수이고 앞뒤 절반이 같은 서로 다른 부분 문자열의 개수를 센다.
난이도

어려움10점 중 8점

유형
문자열, 문자열 매칭, 해시맵, 정렬
정답자
아직 제출이 없습니다

문제

Carlos spends his summer holiday studying duplicated binary strings. A duplicated binary string is a non-empty string TT such that:

  • TT contains only the characters 0 and 1 (that is, TT is a binary string).
  • TT can be written in the form T=UU‾T = \overline{UU}, where UU is an arbitrary binary string and the operation ab‾\overline{ab} denotes the concatenation of the strings aa and bb (i.e., writing them one after the other as a single string).

For example, 0000 and 011011 are duplicated binary strings, but 01, 0110, and 000 are not.

Define the strength of a binary string SS as the number of distinct contiguous duplicated substrings present in SS. Two substrings are considered different if they differ in at least one character.

This problem consists of two parts, with each subtask associated with either Part I or Part II. You may solve the subtasks in any order; in particular, you are not required to complete all of Part I before attempting Part II.

예제

이 문제는 공개된 예제가 없습니다.