問題一覧 > 通常問題

No.3666 League of Jigsaw

レベル : / AI推定難易度 : 2300 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 10
作問者 : tyawanmusi / テスター : dyktr_06 t5ugu sepa38 yuusaan
お気に入りにしたユーザー ProblemId : 13906 / 自分の提出
問題文最終更新日: 2026-08-30 12:58:08
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
MMA Contest 022 (順位表) の他の問題:

Problem Statement

There is a rectangular grid with $3$ rows and $N$ columns. Chawanmushi-kun wants to tile this grid without gaps using three types of tetromino blocks, the "L", "J", and "O" shapes shown in the figure below. From left to right, they are the L, J, and O tetrominoes.

Chawanmushi-kun has $l$ L-blocks, $j$ J-blocks, and $o$ O-blocks. The blocks may be freely rotated and translated, but they may not be flipped (for example, an L-block cannot be used as a J-block).

Determine whether the grid can be completely tiled using all the blocks he has, with no block extending outside the grid and no blocks overlapping. It is guaranteed that the total number of cells in the grid equals the total number of cells in the blocks, that is, $3N=4(l+j+o)$ always holds.

You are given $T$ test cases; solve each of them.

Constraints

  • $1 \leq T \leq 2 \times 10^{5}$
  • $0 \le l,j,o \le 10^9$
  • $4(l+j+o)$ is a multiple of $3$
  • All input values are integers

Input

The input is given from standard input in the following format.

$T$
$\text{case}_1$
$\text{case}_2$
$\vdots$
$\text{case}_T$

Each test case is given in the following format.

$l\ j\ o$

Output

Print Yes if the grid can be tiled, and No otherwise. Print a newline at the end.

Sample

Sample 1
Input
9
1 1 1
4 2 0
1 3 2
2 1 0
0 5 1
1 7 1
10 2 0
2718 2818 284
3141592 6535897 93238462
Output
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No

For the first test case, the $3\times 4$ grid can be tiled as shown in the figure below.

For the second test case, the $3\times 8$ grid can be tiled as shown in the figure below.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。