Codeforces Round 215 (Div. 2)
D
Sereja ans Anagrams
Codeforces
未评级
原题
← CE →
翻译中…

Sereja has two sequences $*a*$ and $*b*$ and number $*p*$. Sequence $*a*$ consists of $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$. Similarly, sequence $*b*$ consists of $*m*$ integers $*b*_{1}, *b*_{2}, ..., *b*_{*m*}$. As usual, Sereja studies the sequences he has. Today he wants to find the number of positions $*q*$ $(*q* + (*m* - 1)·*p* ≤ *n*; *q* ≥ 1)$, such that sequence $*b*$ can be obtained from sequence $*a*_{*q*}, *a*_{*q* + *p*}, *a*_{*q* + 2*p*}, ..., *a*_{*q* + (*m* - 1)*p*}$ by rearranging elements.

翻译中…

Sereja needs to rush to the gym, so he asked to find all the described positions of $*q*$.

翻译中…

Input

翻译中…

The first line contains three integers $*n*$, $*m*$ and $*p*$ $(1 ≤ *n*, *m* ≤ 2·10^{5}, 1 ≤ *p* ≤ 2·10^{5})$. The next line contains $*n*$ integers $*a*_{1}$, $*a*_{2}$, $...$, $*a*_{*n*}$ $(1 ≤ *a*_{*i*} ≤ 10^{9})$. The next line contains $*m*$ integers $*b*_{1}$, $*b*_{2}$, $...$, $*b*_{*m*}$ $(1 ≤ *b*_{*i*} ≤ 10^{9})$.

翻译中…

Output

翻译中…

In the first line print the number of valid $*q*$s. In the second line, print the valid values in the increasing order.

翻译中…

样例

Input #1
5 3 1
1 2 3 2 1
1 2 3
Output #1
2
1 3
InputCopy OutputCopy
Input #2
6 3 2
1 3 2 2 3 1
1 2 3
Output #2
2
1 2
InputCopy OutputCopy
题目信息
题号
368D
时间限制
1 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。