#7355. [UOI 2023 II Stage] Roads of Potokolandiya
[UOI 2023 II Stage] Roads of Potokolandiya
[UOI 2023 II Stage] Roads of Potokolandiya
题目描述
In Potokoland, there are $n$ cities and $n$ two-way roads. The $i$-th road connects cities $i$ and $(i+i)$ (if $i+i>n$, then $i+i-n$).For example, if , the roads will be , , , , and .
Determine if it is possible to travel from any city to any other city using the roads. If not, find a pair of cities that are not connected.
输入格式
The first line contains one integer $n$ ($1 \leq n \leq 10^6$).输出格式
Output $\tt{YES}$ if it is possible to travel from any city to any other city.Otherwise, output on the first line. On the second line, output any two cities and (; ) such that it is impossible to travel from to using the roads.
5
NO
1 5
4
YES
7
NO
1 7
8
YES