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

34464번 - Grid and Numbers Game 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB75571.429%

문제

Busy Beaver and Calico Bear are playing a game with an $N$ by $M$ grid of nonnegative integers $a_{i,j},ドル where initially no two edge-adjacent numbers are equal.

In a move, a player chooses a positive integer in the grid and decreases it by 1ドル,ドル subject to the constraint that after the move, it still holds that no two edge-adjacent numbers are equal and that all numbers are non-negative. If a player has no legal moves on their turn, they lose, and the other player wins.

Busy Beaver moves first, and then the players alternate. Assuming both players play optimally, determine whether or not Busy Beaver has a winning strategy.

입력

Each test contains multiple test cases. The first line of input contains a single integer $T$ (1ドル \leq T \leq 10^4$) --- the number of test cases. The description of each test case follows.

The first line of each test case contains two positive integers $N$ and $M$ (1ドル \leq N, M, N \cdot M \leq 2.5 \cdot 10^5$) --- the dimensions of the grid.

The $i$-th of the next $N$ lines contains $M$ space-separated nonnegative integers $a_{i,1}, \dots, a_{i,M}$ (0ドル \leq a_{i,j} \leq 10^9$), where $a_{i,j}$ represents the integer in the grid in row $i$ and column $j$.

The sum of $N \cdot M$ over all test cases does not exceed 2ドル.5 \cdot 10^5$.

출력

For each test case, output "Yes" (without quotes) if Busy Beaver wins, and "No" (without quotes) if Calico Bear wins.

제한

서브태스크

번호배점제한
120

0ドル \leq a_{i,j} \leq 100$.

280

No additional constraints.

예제 입력 1

5
1 1
1
1 5
0 1 2 3 4
3 3
0 1 0
10 3 10
0 1 0
2 4
0 2 4 6
1 3 5 7
4 5
6 7 6 7 6
7 6 7 6 7
6 7 6 7 6
7 6 7 6 7

예제 출력 1

Yes
No
Yes
No
No

노트

In the first test case, Busy Beaver can decrease the 1ドル$ to a 0ドル$. Then, Calico Bear has no moves, so Busy Beaver has a winning strategy.

In the second test case, Busy Beaver has no legal moves. Therefore, Calico Bear has a winning strategy.

In the third test case, Busy Beaver first decreases the central 3ドル$ to a 2ドル$. Then, regardless of which 10ドル$ Calico Bear decreases, Busy Beaver can decrease the other one. Therefore, Calico Bear runs out of moves before Busy Beaver does, giving Busy Beaver a winning strategy.

출처

University > MIT > M(IT)^2 > M(IT)^2 Winter 2025 Tournament > Beginner Round 7번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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