3599 - Complementary Words 3599 - Palabras Complementarias 3599 - Complementary Words

Statistics Sub: 240 | AC: 109 | AC%: 45,42 | Score: 1,60
Created by Oreste Nillar Cambara
Added by Oreste (2016-03-30)
Limits
Total Time: 8000 MS | Test Time: 2500 MS |Memory: 256 MB | Output: 64 MB | Size: 16 KB
Enabled languages
Available in

Description

This time John has been playing with strings, he has discovered the palindromes strings, a palindrome string is one string that is read in the same way, from left to right and from right to left. John has made a small change to the definition and called the result complementary words.

A word S is complementary if for any pair (0 <= i, j < |S| and i + j = |S|-1) the sum of the character values S[i] + S[j] is the same, and values for a, b, ..., z are 1, 2, ..., 26.
Esta vez, John ha estado jugando con cuerdas, ha descubierto las cadenas de palíndromos, una cadena de palíndromos es una cadena que se lee de la misma manera, de izquierda a derecha y de derecha a izquierda. John ha hecho un pequeño cambio en la definición y ha llamado al resultado palabras complementarias.

Una palabra S es complementaria si para cualquier par
(0 <= i, j < |S| and i + j = |S|-1) la suma de los valores de carácter S [i] + S [j] es la misma, y los valores para a, b, ..., z son 1, 2, ..., 26.
This time John has been playing with strings, he has discovered the palindromes strings, a palindrome string is one string that is read in the same way, from left to right and from right to left. John has made a small change to the definition and called the result complementary words.

A word S is complementary if for any pair (0 <= i, j < |S| and i + j = |S|-1) the sum of the character values S[i] + S[j] is the same, and values for a, b, ..., z are 1, 2, ..., 26.

Input specification

The first line of input contains a non-empty string S (1 <= |S| <= 3000) consisting of lowercase letters. The second line is an integer (1 <= N <= 10^6) representing the number of queries to be performed, line 3, 4, ..., N + 2 contains two integers A, B (0 <= A,B <= |S|-1).
La primera línea de entrada contiene una cadena no vacía S (1 <= |S| <= 3000) que consta de letras minúsculas. La segunda línea es un entero (1 <= N <= 10 ^ 6) que representa el número de consultas a realizar, líneas 3, 4, ..., N + 2 contiene dos enteros A, B (0 <= A, B <= |S|-1).
The first line of input contains a non-empty string S (1 <= |S| <= 3000) consisting of lowercase letters. The second line is an integer (1 <= N <= 10^6) representing the number of queries to be performed, line 3, 4, ..., N + 2 contains two integers A, B (0 <= A,B <= |S|-1).

Output specification

For each query you must print "yes" if the continuous sub-sequence S[A ... B] is a complementary word and "no" otherwise.
Para cada consulta, debe imprimir "yes" si la sub-secuencia continua S [A ... B] es una palabra complementaria y "no" de lo contrario.
The first line of input contains a non-empty string S (1 <= |S| <= 3000) consisting of lowercase letters. The second line is an integer (1 <= N <= 10^6) representing the number of queries to be performed, line 3, 4, ..., N + 2 contains two integers A, B (0 <= A,B <= |S|-1).

Sample input

acecc
4
0 2
1 2
1 3
3 4

Sample output

yes
yes
no
yes

Hint(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recommendation

We have carefully selected several similar problems: 1000 | 3378 | 1049 | 1494 | 1028 | 3573