QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓

#7145. 棋盘游戏

الإحصائيات

bobo 和 yiyi 正在一个拥有 $(n + 1)$ 行和 $(m + 1)$ 列的棋盘上玩游戏。行从上到下编号为 $0, 1, \dots, n$,列从左到右编号为 $0, 1, \dots, m$。

单元格 $(0, 1), (0, 2), \dots, (0, m), (1, 0), (2, 0), \dots, (n, 0)$ 是特殊单元格。它们可能包含“天堂之门”或“地狱之门”。进入“天堂之门”的人立即获胜。然而,进入“地狱之门”的人会死亡,并将胜利拱手让给对方。

游戏持续 $q$ 轮。在每一轮中,棋子最初放置在单元格 $(x_i, y_i)$ 上。bobo 和 yiyi 轮流移动棋子。bobo 先手。在一次移动中,棋子可以向上或向左移动一格。

请确定在每一轮中 bobo 是否能获胜。你知道的,bobo 和 yiyi 都是非常聪明的人……

输入格式

第一行包含 3 个整数 $n, m, q$ ($1 \le n, m, q \le 200000$)。

第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($0 \le a_i \le 1$)。如果单元格 $(i, 0)$ 包含“天堂之门”,则 $a_i = 0$。如果单元格 $(i, 0)$ 包含“地狱之门”,则 $a_i = 1$。

第三行包含 $m$ 个整数 $b_1, b_2, \dots, b_m$ ($0 \le b_i \le 1$)。如果单元格 $(0, i)$ 包含“天堂之门”,则 $b_i = 0$。如果单元格 $(0, i)$ 包含“地狱之门”,则 $b_i = 1$。

最后 $q$ 行,每行包含 2 个整数 $x_i, y_i$ ($1 \le x_i \le n, 1 \le y_i \le m$)。

输出格式

对于每一轮,如果 bobo 能获胜,输出 “Yes”,否则输出 “No”。

样例

输入格式 1

2 2 4
1 0
1 1
1 1
1 2
2 1
2 2

输出格式 1

No
Yes
Yes
No

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.