1665.
String and String
时间限制 3000 ms
内存限制 512 MB
You are given two strings S and T ,we define the "Sval" :
1. consider the substring $T.substring(a_i\otimes ans,b_i\otimes ans)$ in the substring $S.substring(c_i\otimes ans,d_i\otimes ans)$ perfect matching.
2. assume all the positions of matching is $[x_0,y_0],[x_1,y_1]...[x_k,y_k]$ while
$T.substring(a_i\otimes ans,b_i\otimes ans)$=$S.substring(x_0,y_0)$=$S.substring(x_1,y_1)$=...=$S.substring(x_k,y_k)$ $\quad (c_i\otimes ans\leq x_i,y_i\leq d_i\otimes ans)$
3. define then $ Sval=\sum_{i=0}^{k}f[y_i]$
And Zhu thinks it's too easy and he can modify the $f[a_i\otimes ans]$ to $b_i\otimes ans$.
note:
1. the "$ans$" shows before is the answer of the last query,at first ans=0.
2. the symbol "$\otimes$" is xor in binary system
3. the index is 0-based
输入数据
输出数据
For each query output one integer which means the answer.
样例输入
复制
1
aaaa
aaaa
0 1 2 3
3
2 0 0 0 3
1 6 3
2 6 6 6 5
\n
\n
\n
· · · \n
\n
· · · · \n
· · \n
· · · · \n