#P3949. 答案错误

答案错误

Description

Each problem that was WA has a score. To judge whether the degree of WA problems is the same for the two people, Xiao X uses the following method:

When bored, she came up with a magical function:

f(x)=a1x0+a2x1+a3x2++anxn1f(x)=a_1x^0+a_2x^1+a_3x^2+\cdots+a_{n}x^{n-1}

She believes that no matter what values aia_i take, if the sums of f(x)f(x) over two groups are equal, then the error levels of the two groups of problems are very similar.

Suppose there are two modified sets of WA problems with scores A={1,4,6,7}A=\{1,4,6,7 \} and B={2,3,5,8}B=\{2,3,5,8\}. When a1=a2=a3=1a_1=a_2=a_3=1, the magical function is:

f(x)=x2+x+1f(x)=x^2+x+1

Then f(1)=3,f(2)=7,f(3)=13f(1)=3, f(2)=7, f(3)=13 \cdots.

Obviously: $f(1) + f(4) + f(6) + f(7) = 124 = f(2) + f(3) + f(5) + f(8)$.

For this set of coefficients, this partition is valid. It can be proven that for any values of aia_i, grouping according to the above scheme satisfies the condition (the sums of f(x)f(x) over the two groups are the same). If you do not believe it, you can enumerate manually (#huaji).

So A={1,4,6,7},B={2,3,5,8}A=\{1,4,6,7 \}, B=\{2,3,5,8\} is a valid grouping.

Input Format

The first line contains an integer nn, meaning there are 2n2^n WA problems, with scores from 11 to 2n2^n, with n2n \ge 2.

The second line contains an integer qq, indicating there are qq queries.

The last line contains qq integers, each asking whose name is on the WA problem with score xx.

(Because Xiao X is relatively weak, we assume the WA problem with score 11 belongs to her.)

Output Format

Output qq lines, each containing a character X\verb!X! or Z\verb!Z!, indicating whose signature is on the WA problem with score xx.

3
2
4 5
X
Z

Hint

Constraints and Conventions

  • For 10%10\% of the testdata, 2n42 \le n \le 4, q10q \le 10.
  • For 40%40\% of the testdata, 2n202 \le n \le 20, 1q50001 \le q \le 5000.
  • For 100%100\% of the testdata, 2n602 \le n \le 60, q106q \le 10^6.

Translated by ChatGPT 5