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

19062번 - Mikhail's Problem 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB55171231.579%

문제

You are given a string $s$ and several queries. For the $i$-th query, calculate the number of different palindromic substrings of $s[l_i .. r_i]$. A substring is called palindromic if it reads the same from right to left as from left to right. Two substrings are considered different if they differ as strings.

입력

The first line contains a non-empty string $s$ consisting of lowercase English letters. The length of the string does not exceed 10ドル^5$ characters.

The second line contains an integer $q,ドル the number of queries (1ドル \leq q \leq 10^5$). Next $q$ lines contain queries. Each of these lines contains integers $l_i$ and $r_i$ separated by a space (1ドル \leq l_i \leq r_i \leq |s|$).

출력

Output $q$ lines. The $i$-th line must contain one integer: the answer to the $i$-th query.

제한

예제 입력 1

bbabaabbcabcabc
10
1 7
1 8
1 9
1 10
2 7
2 8
2 9
2 10
7 15
8 15

예제 출력 1

7
7
8
8
6
7
8
8
4
3

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 3: Ural Contest H번

Contest > Open Cup > 2017/2018 Season > Stage 2: Grand Prix of Ural H번

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

출처

대학교 대회

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

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