AtCoder Japan Open -予選-(AtCoder Regular Contest 186)
A
Underclued
AtCoder
⌀ 2511
原题
←B →
翻译中…

Problem Statement

翻译中…

For two $N \times N$ matrices $A$ and $B$ whose elements are $0$ or $1$, we say that $A$ and $B$ are similar if they satisfy the following conditions:

翻译中…
  • The sums of corresponding rows are equal. That is, $A_{i,1} + \dots + A_{i,N} = B_{i,1} + \dots + B_{i,N}$ for any $i=1,\dots,N$.
  • The sums of corresponding columns are equal. That is, $A_{1,j} + \dots + A_{N,j} = B_{1,j} + \dots + B_{N,j}$ for any $j=1,\dots,N$.
翻译中…

Furthermore, for an $N \times N$ matrix $A$ whose elements are $0$ or $1$, and integers $i,j$ ($1 \leq i,j \leq N$), we say that the element at row $i$ column $j$ is fixed if $A_{i,j} = B_{i,j}$ holds for any matrix $B$ that is similar to $A$.

翻译中…

Answer the following $Q$ queries:

翻译中…
  • The $i$-th query: If there exists an $N \times N$ matrix whose elements are $0$ or $1$ such that exactly $K_i$ elements are fixed, output Yes; otherwise, output No.
翻译中…

Constraints

翻译中…
  • $2 \le N \le 30$
  • $1 \le Q \le N^2+1$
  • $0 \le K_i \le N^2$
  • $K_i \ne K_j (1 \le i < j \le Q)$
  • All inputs are integers
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N Q
K_1
K_2
\vdots
K_Q

翻译中…

Output

翻译中…

Output $Q$ lines. For the $i$-th line $(1 \le i \le Q)$, output the answer for the $i$-th query.

翻译中…

样例

Input #1
3 3
0
9
7
Output #1
Yes
Yes
No
Query 1: For example, the following matrix $X$ has exactly $0$ fixed elements. This is because all the following matrices, obtained by cyclically shifting the columns, are similar to $X$, and each element can be either $0$ or $1$. Query 2: For example, the following matrix $X$ has exactly $9$ fixed elements. This is because no other matrix similar to $X$ exists, and all elements are fixed. Query 3: No matrix exists with exactly $7$ fixed elements.
Input #2
29 6
186
681
18
108
123
321
Output #2
No
Yes
No
Yes
No
Yes
题目信息
题号
arc186_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。