Interview
InterviewTime limit1sMemory limit1024 MB
For each query X, count the contiguous groups of students among the first X that contain no student in Eunho's grade.
- Level
Easy3 of 10
- Topics
- Array, Prefix sum, Math
- Solved
- No attempts yet
Problem
The cafeteria line at Seoul Science High School is long. Eunho wants to interview some students who stand in consecutive positions in the line. However, students in the same grade as Eunho cannot be interviewed.
Currently students are standing in the line. Eunho wonders how many ways he can conduct an interview. Answer the queries below to satisfy his curiosity.
- When interviewing several consecutive students among the first students, how many ways are there to choose them so that no student in the same grade as Eunho is included?
Input
The first line contains the number of students , Eunho's grade , and the number of queries , separated by spaces. The second line contains the grades of the students in the line, separated by spaces. Student is the one standing -th from the front. The third line contains the integers , separated by spaces.
Output
For each query, print the number of possible interview choices on its own line.
Constraints
- ()