Alice and Bob have bought a ribbon consisting of 𝑛 parts. Now they want to paint it.…
- User
Alice and Bob have bought a ribbon consisting of 𝑛 parts. Now they want to paint it.
First, Alice will paint every part of the ribbon into one of 𝑚 colors. For each part, she can choose its color arbitrarily.
Then, Bob will choose at most 𝑘 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 𝑡 (1≤𝑡≤1000 ) — the number of test cases.
Each test case consists of one line containing three integers 𝑛 , 𝑚 and 𝑘 (1≤𝑚,𝑘≤𝑛≤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.
- Assistant
To solve this problem, we need to determine whether Alice can paint the ribbon in such a way that no matter which at most (k) parts Bob repaints, he cannot make all the parts have the same color.
First, let's analyze the minimal number of repaintings Bob needs to make the ribbon monochromatic (all parts the same color). Bob can choose the color with the maximum count on the ribbon and repaint all other parts to this color. So, the minimal number of parts Bob needs to repaint is (n - \text{max}_i\ c_i), where (\text{max}_i\ c_i) is the maximum count of any color (i) on the ribbon.
Alice wants to prevent Bob from achieving this. Therefore, she should paint the ribbon in such a way that the maximum count of any color is less than (n - k). The minimal possible value for (\text{max}_i\ c_i) is (\lceil \frac{n}{m} \rceil), since she distributes the colors as evenly as possible.
Therefore, the condition for Alice to prevent Bob is: [ n - k > \lceil \frac{n}{m} \rceil ] Simplifying: [ k < n - \lceil \frac{n}{m} \rceil ]
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.