题库练习 Domino on Windowsill
← 上一题 下一题 →

A14069 | Domino on Windowsill

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You have a board represented as a grid with $2 \times n$ cells.

The first $k_1$ cells on the first row and first $k_2$ cells on the second row are colored in white. All other cells are colored in black.

You have $w$ white dominoes ( $2 \times 1$ tiles, both cells are colored in white) and $b$ black dominoes ( $2 \times 1$ tiles, both cells are colored in black).

You can place a white domino on the board if both board's cells are white and not occupied by any other domino. In the same way, you can place a black domino if both cells are black and not occupied by any other domino.

Can you place all $w + b$ dominoes on the board if you can place dominoes both horizontally and vertically?

输入格式

The first line contains a single integer $t$ ( $1 \le t \le 3000$ ) — the number of test cases.

The first line of each test case contains three integers $n$ , $k_1$ and $k_2$ ( $1 \le n \le 1000$ ; $0 \le k_1, k_2 \le n$ ).

The second line of each test case contains two integers $w$ and $b$ ( $0 \le w, b \le n$ ).

输出格式

For each test case, print YES if it's possible to place all $w + b$ dominoes on the board and NO, otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES are all recognized as positive answer).

输入输出样例

输入 #1
5
1 0 1
1 0
1 1 1
0 0
3 0 0
1 3
4 3 1
2 2
5 4 3
3 1
输出 #1
NO
YES
NO
YES
YES
C++ 编辑器
输入
输出