311235: CF1954A. Painting the Ribbon

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Painting the Ribbontime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

Alice and Bob have bought a ribbon consisting of $n$ parts. Now they want to paint it.

First, Alice will paint every part of the ribbon into one of $m$ colors. For each part, she can choose its color arbitrarily.

Then, Bob will choose at most $k$ parts of the ribbon and repaint them into the same color (he chooses the affected parts and the color arbitrarily).

Bob would like all parts to have the same color. However, Alice thinks that this is too dull, so she wants to paint the ribbon in such a way that Bob cannot make all parts have the same color.

Is it possible to paint the ribbon in such a way?

Input

The first line contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases.

Each test case consists of one line containing three integers $n$, $m$ and $k$ ($1 \le m, k \le n \le 50$) — the number of parts, the number of colors and the number of parts Bob can repaint, respectively.

Output

For each test case, print YES if Alice can paint the ribbon so that Bob cannot make all parts have the same color. Otherwise, print NO.

You can print every letter in any register. For example, Yes, yes, yEs will all be recognized as positive answer.

ExampleInput
5
1 1 1
5 1 1
5 2 1
5 2 2
5 5 3
Output
NO
NO
YES
NO
YES
Note

In the first test case, a ribbon consists of $1$ part. So all its parts will always have the same color.

In the second test case, there is only $1$ color.

In the third test case, Alice can paint the ribbon as follows: $[1, 2, 1, 2, 1]$. It's impossible to change the color of at most $1$ part so that all parts have the same color.

In the fourth test case, no matter how Alice paints the ribbon, Bob will always be able to repaint $2$ parts so that all parts have the same color.

In the fifth test case, Alice can paint the ribbon as follows: $[1, 2, 3, 4, 5]$. It's impossible to change the color of at most $3$ parts so that all parts have the same color.

Output

题目大意:
爱丽丝和鲍勃买了一根由n段组成的彩带,现在他们想要给彩带涂色。首先,爱丽丝会用m种颜色中的任意一种给每段彩带涂色。然后,鲍勃会选择最多k段彩带,并将它们涂成相同的颜色(他可以任意选择受影响的段和颜色)。鲍勃希望所有段的颜色都相同,但爱丽丝认为这样太单调,所以她希望以这样的方式涂色,使得鲍勃无法让所有段的颜色都相同。问是否可以以这样的方式涂色。

输入数据格式:
第一行包含一个整数t(1≤t≤1000)——测试用例的数量。
每个测试用例包含一行,包含三个整数n、m和k(1≤m,k≤n≤50)——分别是段的数量、颜色的数量和鲍勃可以重新涂色的段的数量。

输出数据格式:
对于每个测试用例,如果爱丽丝可以涂色使得鲍勃无法让所有段的颜色都相同,则打印YES。否则,打印NO。
可以以任何大小写形式打印每个字母。例如,Yes、yes、yEs都将被视为肯定回答。

注意:
在第一个测试用例中,彩带只有1段。所以它的所有段总是具有相同的颜色。
在第二个测试用例中,只有1种颜色。
在第三个测试用例中,爱丽丝可以按以下方式涂色:[1, 2, 1, 2, 1]。不可能改变最多1段的颜色,使得所有段的颜色都相同。
在第四个测试用例中,无论爱丽丝如何涂色,鲍勃总是能够重新涂色2段,使得所有段的颜色都相同。
在第五个测试用例中,爱丽丝可以按以下方式涂色:[1, 2, 3, 4, 5]。不可能改变最多3段的颜色,使得所有段的颜色都相同。题目大意: 爱丽丝和鲍勃买了一根由n段组成的彩带,现在他们想要给彩带涂色。首先,爱丽丝会用m种颜色中的任意一种给每段彩带涂色。然后,鲍勃会选择最多k段彩带,并将它们涂成相同的颜色(他可以任意选择受影响的段和颜色)。鲍勃希望所有段的颜色都相同,但爱丽丝认为这样太单调,所以她希望以这样的方式涂色,使得鲍勃无法让所有段的颜色都相同。问是否可以以这样的方式涂色。 输入数据格式: 第一行包含一个整数t(1≤t≤1000)——测试用例的数量。 每个测试用例包含一行,包含三个整数n、m和k(1≤m,k≤n≤50)——分别是段的数量、颜色的数量和鲍勃可以重新涂色的段的数量。 输出数据格式: 对于每个测试用例,如果爱丽丝可以涂色使得鲍勃无法让所有段的颜色都相同,则打印YES。否则,打印NO。 可以以任何大小写形式打印每个字母。例如,Yes、yes、yEs都将被视为肯定回答。 注意: 在第一个测试用例中,彩带只有1段。所以它的所有段总是具有相同的颜色。 在第二个测试用例中,只有1种颜色。 在第三个测试用例中,爱丽丝可以按以下方式涂色:[1, 2, 1, 2, 1]。不可能改变最多1段的颜色,使得所有段的颜色都相同。 在第四个测试用例中,无论爱丽丝如何涂色,鲍勃总是能够重新涂色2段,使得所有段的颜色都相同。 在第五个测试用例中,爱丽丝可以按以下方式涂色:[1, 2, 3, 4, 5]。不可能改变最多3段的颜色,使得所有段的颜色都相同。

加入题单

上一题 下一题 算法标签: