{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"A particular subgroup of K (1 \u0026lt;\u003d K \u0026lt;\u003d 25,000) of Farmer John\u0027s cows likes to make trouble. When placed in a line, these troublemakers stand together in a particular order. In order to locate these troublemakers, FJ has lined up his N (1 \u0026lt;\u003d N \u0026lt;\u003d 100,000) cows. The cows will file past FJ into the barn, staying in order. FJ needs your help to locate suspicious blocks of K cows within this line that might potentially be the troublemaking cows.\r\u003cbr\u003e\r\u003cbr\u003eFJ distinguishes his cows by the number of spots 1..S on each cow\u0027s coat (1 \u0026lt;\u003d S \u0026lt;\u003d 25). While not a perfect method, it serves his purposes. FJ does not remember the exact number of spots on each cow in the subgroup of troublemakers. He can, however, remember which cows in the group have the same number of spots, and which of any pair of cows has more spots (if the spot counts differ). He describes such a pattern with a sequence of K ranks in the range 1..S. For example, consider this sequence:\r\u003cbr\u003e\r\u003cbr\u003e\u003cpre\u003e 1 4 4 3 2 1\u003c/pre\u003eIn this example, FJ is seeking a consecutive sequence of 6 cows from among his N cows in a line. Cows #1 and #6 in this sequence have the same number of spots (although this number is not necessarily 1) and they have the smallest number of spots of cows #1..#6 (since they are labeled as \u00271\u0027). Cow #5 has the second-smallest number of spots, different from all the other cows #1..#6. Cows #2 and #3 have the same number of spots, and this number is the largest of all cows #1..#6.\r\u003cbr\u003e\r\u003cbr\u003eIf the true count of spots for some sequence of cows is:\r\u003cbr\u003e\r\u003cbr\u003e\u003cpre\u003e 5 6 2 10 10 7 3 2 9\u003c/pre\u003ethen only the subsequence 2 10 10 7 3 2 matches FJ\u0027s pattern above.\r\u003cbr\u003e\r\u003cbr\u003ePlease help FJ locate all the length-K subsequences in his line of cows that match his specified pattern."}},{"title":"Input","value":{"format":"HTML","content":"Line 1: Three space-separated integers: N, K, and S\r\u003cbr\u003e\r\u003cbr\u003eLines 2..N+1: Line i+1 describes the number of spots on cow i.\r\u003cbr\u003e\r\u003cbr\u003eLines N+2..N+K+1: Line i+N+1 describes pattern-rank slot i."}},{"title":"Output","value":{"format":"HTML","content":"Line 1: The number of indices, B, at which the pattern matches\r\u003cbr\u003e\r\u003cbr\u003eLines 2..B+1: An index (in the range 1..N) of the starting location where the pattern matches."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e9 6 10\r\n5\r\n6\r\n2\r\n10\r\n10\r\n7\r\n3\r\n2\r\n9\r\n1\r\n4\r\n4\r\n3\r\n2\r\n1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n3\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"Explanation of the sample:\r\u003cbr\u003e\r\u003cbr\u003eThe sample input corresponds to the example given in the problem statement.\r\u003cbr\u003e\r\u003cbr\u003eThere is only one match, at position 3 within FJ\u0027s sequence of N cows."}}]}