Score : $400$ points
You are given a sequence of length $N$: $A=(A_1,A_2,\dots,A_N)$. The following action on this sequence is called an operation.
Answer $Q$ questions.
The $i$-th question is the following.
Input is given from Standard Input in the following format:
$N$ $Q$ $A_1$ $A_2$ $\dots$ $A_N$ $X_1$ $X_2$ $\vdots$ $X_Q$
Print $Q$ lines.
The $i$-th line should contain the answer to the $i$-th question as an integer.
5 3 6 11 2 5 5 5 20 0
10 71 29
We have $A=(6,11,2,5,5)$ and three questions in this input.
For the $1$-st question, you can change every element of $A$ to $5$ in $10$ operations as follows.
It is impossible to change every element of $A$ to $5$ in $9$ or fewer operations.
For the $2$-nd question, you can change every element of $A$ to $20$ in $71$ operations.
For the $3$-rd question, you can change every element of $A$ to $0$ in $29$ operations.
10 5 1000000000 314159265 271828182 141421356 161803398 0 777777777 255255255 536870912 998244353 555555555 321654987 1000000000 789456123 0
3316905982 2811735560 5542639502 4275864946 4457360498
The output may not fit into $32$-bit integers.