A - No Attacking Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 400

問題文

N マス、横 N マスのチェス盤があります。チェス盤の上から i 行目、左から j 列目のマスを (i, j) と呼びます。
これから駒を盤に並べます。駒は 2 種類あり、それぞれ ルーク, ポーン と呼びます。
駒の並び方が次の条件を満たすとき 良い配置 と呼びます。

  • 1 つのマスにつき 0 個または 1 個の駒が置かれている。
  • (i, j) にルークがあるとき、k \neq j であるすべての k (1 \leq k \leq N) に対して (i, k) に駒が存在しない。
  • (i, j) にルークがあるとき、k \neq i であるすべての k (1 \leq k \leq N) に対して (k, j) に駒が存在しない。
  • (i, j) にポーンがあり、かつ i \geq 2 であるとき、(i-1, j) に駒が存在しない。

A 個のルークと B 個のポーンを良い配置になるように全て盤に並べることは可能ですか?

T 個のテストケースが与えられるので、それぞれについて答えを求めてください。

制約

  • 1 \leq T \leq 10^5
  • 1 \leq N \leq 10^4
  • 0 \leq A, B
  • 1 \leq A + B \leq N^2
  • 入力される値は全て整数

入力

入力は以下の形式で標準入力から与えられる。ここで、\mathrm{case}_ii 番目のケースを意味する。

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T

各テストケースは以下の形式で与えられる。

N A B

出力

T 行出力せよ。i 行目では i 番目のテストケースに対する答えを出力せよ。
各テストケースでは、良い配置になるように並べることが可能ならば Yes を、そうでない場合は No を出力せよ。


入力例 1

8
5 2 3
6 5 8
3 2 2
11 67 40
26 22 16
95 91 31
80 46 56
998 2 44353

出力例 1

Yes
No
No
No
Yes
No
Yes
Yes

1 番目のテストケースでは、例えばルークを (1, 1)(2, 4) に、ポーンを (3, 3)(4, 2)(5, 3) に配置することで全ての駒を良い配置になるように並べることが可能です。
2 番目のテストケースでは、全ての駒を良い配置になるように並べることは不可能です。

Score: 400 points

Problem Statement

There is a chessboard with N rows and N columns. Let (i, j) denote the square at the i-th row from the top and the j-th column from the left.
You will now place pieces on the board. There are two types of pieces, called rooks and pawns.
A placement of pieces is called a good arrangement when it satisfies the following conditions:

  • Each square has zero or one piece placed on it.
  • If there is a rook at (i, j), there is no piece at (i, k) for all k (1 \leq k \leq N) where k \neq j.
  • If there is a rook at (i, j), there is no piece at (k, j) for all k (1 \leq k \leq N) where k \neq i.
  • If there is a pawn at (i, j) and i \geq 2, there is no piece at (i-1, j).

Is it possible to place all A rooks and B pawns on the board in a good arrangement?

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

Constraints

  • 1 \leq T \leq 10^5
  • 1 \leq N \leq 10^4
  • 0 \leq A, B
  • 1 \leq A + B \leq N^2
  • All input values are integers.

Input

The input is given from Standard Input in the following format. Here, \mathrm{case}_i represents the i-th case.

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T

Each test case is given in the following format.

N A B

Output

Print T lines. The i-th line should contain the answer for the i-th test case.
For each test case, print Yes if it is possible to place the pieces in a good arrangement and No otherwise.


Sample Input 1

8
5 2 3
6 5 8
3 2 2
11 67 40
26 22 16
95 91 31
80 46 56
998 2 44353

Sample Output 1

Yes
No
No
No
Yes
No
Yes
Yes

In the first test case, for example, you can place rooks at (1, 1) and (2, 4), and pawns at (3, 3), (4, 2), and (5, 3) to have all the pieces in a good arrangement.
In the second test case, it is impossible to place all the pieces in a good arrangement.