{"problem":{"name":"Underclued","description":{"content":"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","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc186_a"},"statements":[{"statement_type":"Markdown","content":"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:\n\n*   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$.\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$.\n\nFurthermore, 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$.\nAnswer the following $Q$ queries:\n\n*   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`.\n\n## Constraints\n\n*   $2 \\le N \\le 30$\n*   $1 \\le Q \\le N^2+1$\n*   $0 \\le K_i \\le N^2$\n*   $K_i \\ne K_j (1 \\le i < j \\le Q)$\n*   All inputs are integers\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $Q$\n$K_1$\n$K_2$\n$\\vdots$\n$K_Q$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc186_a","tags":[],"sample_group":[["3 3\n0\n9\n7","Yes\nYes\nNo\n\nQuery 1: For example, the following matrix $X$ has exactly $0$ fixed elements.\n\n1 0 0\n0 1 0\n0 0 1\n\nThis 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$.\n\n0 0 1\n1 0 0\n0 1 0\n\n0 1 0\n0 0 1\n1 0 0\n\nQuery 2: For example, the following matrix $X$ has exactly $9$ fixed elements.\n\n0 0 1\n0 1 1\n1 1 1\n\nThis is because no other matrix similar to $X$ exists, and all elements are fixed.\nQuery 3: No matrix exists with exactly $7$ fixed elements."],["29 6\n186\n681\n18\n108\n123\n321","No\nYes\nNo\nYes\nNo\nYes"]],"created_at":"2026-03-03 11:01:14"}}