Maximum consecutive subsequence

Given a sequence of n integer numbers x₁…x_(n), and an integer number x,
let L(x) be the maximum length of all the subsequences made up of only
x. That is, L(x) is the maximum number of times that x appears
consecutively in the sequence (or zero, if x is not there). Given
several x, can you compute each L(x)?

Input

Input consists of several cases. Every case begins with n, followed by
x₁…x_(n), followed by a natural number q, followed by q different
integer numbers x about which you are asked.

Output

For every case, print a line with the q answers L(x) separated with
spaces.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T12:05:45.976Z

© Jutge.org, 2006–2026.
https://jutge.org
