| EPT Solving Cup 6.0 |
|---|
| Закончено |
You are given an $$$n \times n$$$ grid of bits (each cell is either 0 or 1). Initially, the grid is filled with 0.
The grid is placed on a torus: row and column indices are taken modulo $$$n$$$. Formally, for any integer $$$x$$$ define $$$ wrap(x) = ((x-1) \bmod n) + 1. $$$
You may apply the following operation any number of times:
You are given $$$q$$$ target grids. For each target grid, determine whether it can be obtained from the all-zero grid using the operations above.
The first line contains three integers $$$n$$$, $$$k$$$, $$$q$$$: $$$ 3 \le n \le 2000,\quad 3 \le k \le n,\quad k \text{ is odd},\quad 1 \le q \le 2000. $$$ Additionally, it is guaranteed that $$$ q \cdot n^2 \le 2 \cdot 10^7. $$$ Then follow $$$q$$$ grids. Each grid is given by $$$n$$$ lines, each containing a string of length $$$n$$$ consisting only of characters 0 and 1.
Print $$$q$$$ lines. For each grid, print YES if it is reachable from the all-zero grid, otherwise print NO.
3 3 3000000000111111111100000000
YES YES NO
| Название |
|---|


