P19462 [CodeChef] CHEFSPICE
提高+
题目描述

You have an $N \times M$ grid consisting of N rows numbered 1 to N from top to bottom and M columns numbered 1 to M from left to right. Each cell of the grid is initially white.

You can perform the following operation any number of times (possibly zero):
Select a row i (1 ≤ i ≤ N) and paint all the cells in row i black.
Or select a column i (1 ≤ i ≤ M) and paint all the cells in column i black.

Note that cells which are already black remain black if they are painted over again.

Determine if it is possible to paint exactly K cells of the grid black after performing some operations.

------ Input Format ------

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of a single line containing N, M and K — the number of rows, the number of columns and the number of cells to paint black.

------ Output Format ------

For each test case, output the string YES if it is possible to paint exactly K cells black, and NO if it is not.

You may print each character of YES and NO in uppercase or lowercase (for example, yes, yEs, Yes will be considered identical).

------ Constraints ------

$1 ≤ T ≤ 2000$
$3 ≤ N, M ≤ 10^{9}$
$0 ≤ K ≤ 10^{9}$

----- Sample Input 1 ------
2
3 5 13
3627 17424 27008005
----- Sample Output 1 ------
YES
NO
----- explanation 1 ------
Test case 1: One possible sequence of operations is as follows:
- Select column $2$ and paint it black.
- Select row $1$ and paint it black.
- Select column $4$ and paint it black.
- Select column $5$ and paint it black.
- Select row $3$ and paint it black.

After performing these operations, the grid contains exactly $13$ black cells. Hence the answer is YES.

输入格式

见题面

输出格式

见题面

样例输入
2 3 5 13 3627 17424 27008005
样例输出
YES NO