#P6476. Non-Boring Coloring
Non-Boring Coloring
Non-Boring Coloring
You are given \(10^{20}\) cells, numbered starting from \(0\). Initially, all cells are uncolored. You will color the cells according to the following rules:
- Cells with indices that are multiples of \(p_{1}\) (including cell \(0\)) must be colored red.
- Cells with indices that are multiples of \(p_{2}\) must be colored blue.
- If a cell's index is a multiple of both \(p_{1}\) and \(p_{2}\), you may choose either red or blue for that cell.
Note that every cell whose index is a multiple of \(p_{1}\) or \(p_{2}\) must be colored. After discarding any uncolored cells, the resulting sequence (in increasing order of indices) must not contain a contiguous block of \(k\) cells all having the same color; otherwise, you consider the coloring scheme to be boring. Given \(p_{1}\), \(p_{2}\), and \(k\), determine whether a non-boring coloring exists.
inputFormat
The input consists of a single line with three space-separated integers: \(p_{1}\), \(p_{2}\), and \(k\).
outputFormat
Output YES if there exists a coloring scheme that avoids having \(k\) consecutive cells of the same color (after discarding uncolored cells), and NO otherwise.
sample
2 3 2
YES