Logo
(追記) (追記ここまで)

31347번 - Chessboard Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB38141440.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.

제한

예제 입력 1

2 2 4
10
11
1 1
1 2
2 1
2 2

예제 출력 1

No
Yes
Yes
No

힌트

출처

Contest > Open Cup > 2014/2015 Season > Stage 10: Grand Prix of China B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /