#P6476. [NOI Online #2 提高组] 涂色游戏
[NOI Online #2 提高组] 涂色游戏
Background
1s 256M
Problem Description
You have cells, numbered starting from . Initially, all cells are uncolored. Now you color them according to the following rules:
- Cells whose indices are multiples of (including cell , same below) are colored red.
- Cells whose indices are multiples of are colored blue.
- For cells whose indices are multiples of both and , you may choose to color them red or blue.
Here and are given integers. If a cell index is a multiple of or , then it must be colored. After ignoring all uncolored cells, you do not want there to be consecutive cells with the same color, because you think such a coloring scheme is boring. Given , , and , you want to know whether there exists a coloring scheme that is not boring.
Input Format
This problem contains multiple test cases.
The first line contains an integer indicating the number of test cases.
Each test case consists of one line with three positive integers , , , with meanings as described above.
Output Format
For each test case, output one line with a string. If there exists a coloring scheme that is not boring, output YES, otherwise output NO.
Any output format that matches one of the formats in the samples or the statement is accepted, i.e. it is case-insensitive. For example, if the standard answer is YES, then YES/Yes/yes are all considered correct.
4
2 10 4
2 3 6
1 4 7
1 1 2
No
Yes
Yes
Yes
8
370359350 416913505 3
761592061 153246036 6
262185277 924417743 5
668232501 586472717 2
891054824 169842323 6
629603359 397927152 2
2614104 175031972 68
924509243 421614240 4
Yes
Yes
Yes
No
No
No
Yes
Yes
Hint
| Test Point ID | , | ||
|---|---|---|---|
| 1 3 | |||
| 4 6 | |||
| 7 8 | |||
| 9 10 | |||
| 11 12 | |||
| 13 14 | |||
| 15 | |||
| 16 20 | |||
Constraints for all test points: , .
Translated by ChatGPT 5