| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 38 | 14 | 14 | 40.000% |
bobo and yiyi are playing a game on a chessboard with $(n + 1)$ rows and $(m + 1)$ columns. Rows are numbered by 0,ドル 1, \dots, n$ from top to bottom, while columns are numbered by 0,ドル 1, \dots, m$ from left to right.
Cells $(0, 1), (0, 2), \dots, (0, m), (1, 0), (2, 0), \dots, (n, 0)$ are special. They may contain a "heaven gate" or "hell gate". People who enters a "heaven gate" immediately wins. However, the one who enters a "hell gate" dies and gives the victory to the other.
The game lasts for $q$ rounds. In each round, a chess is placed on cell $(x_i, y_i)$ initially. bobo and yiyi moves alternatively. bobo goes first. In one move, chess can be moved one cell upward or leftward.
Determine if bobo can win for each round. You know, bobo and yiyi are really clever guys ...
The first line contains 3ドル$ integers $n, m, q$ (1ドル \leq n, m, q \leq 2 \cdot 10^5$).
The second line contains $n$ integers $a_1, a_2, \dots, a_n$ (0ドル \leq a_i \leq 1$). If cell $(i, 0)$ contains a "heaven gate", then $a_i = 0$. If cell $(i, 0)$ contains a "hell gate" instead, then $a_i = 1$.
The third line contains $m$ integers $b_1, b_2, \dots, b_m$ (0ドル \leq b_i \leq 1$). If cell $(0, i)$ contains a "heaven gate", then $b_i = 0$. If cell $(0, i)$ contains a "hell gate" instead, then $b_i = 1$.
Each of the last $q$ lines contains 2ドル$ integers $x_i, y_i$ (1ドル \leq x_i \leq n, 1 \leq y_i \leq m$).
For each rounds, print "Yes" if bobo can win. Print "No" otherwise.
2 2 4 10 11 1 1 1 2 2 1 2 2
No Yes Yes No