| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 (추가 시간 없음) | 1024 MB | 26 | 17 | 17 | 65.385% |
King Kendrick is a sovereign ruler of Kotlin Kingdom. He is getting ready for the next session of the government. Kotlin Kingdom consists of $n$ cities. These cities need to be connected by several bidirectional roads. Since ministries are responsible for aspects of safety and comfort of the kingdom's residents, some of them have made the following requirements:
King Kendrick has issues with the requirements from the Ministry of ICPC. He asks you to help him. Find any set of roads that suits all the requirements above or say that it is impossible.
The only line of the input consists of two integers $n$ and $k$ ($1 \le k \le n \le 500$).
If it is impossible to satisfy all the requirements, output "NO" in the only line.
Otherwise, output "YES" in the first line.
Output $m$ --- the number of roads ($0 \le m \le \frac{n \cdot (n - 1)}{2}$) in the second line.
Next $m$ lines should contain pairs of integers $a$ and $b$ --- the cities to connect by a road ($1 \le a, b \le n$).
5 2
YES 4 1 2 1 3 1 4 1 5
City $1$ has four roads connected to it while other cities have exactly one.
4 1
YES 4 1 2 2 3 3 4 4 1
Every city has exactly two roads connected to it.