시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB30012711856.190%

문제

Let $s$ be an arithmetic sequence consisting of $2n$ integers, where the first term is denoted as $a$ and the common difference as $b$. In other words, $s = [a, a+b, a+2b, \ldots, a+(2n-1)b]$.

You should perform a sequence of $n$ operations, where each operation involves selecting two coprime integers from $s$ and erasing them. Once an integer is erased from $s$, it cannot be selected again for any subsequent operations.

Find any sequence of operations satisfying the above conditions, or report that such a sequence does not exist.

입력

The first line contains three integers $n, a, b$. ($1 \leq n \leq 10^5$, $1 \leq a, b \leq 10^9$)

출력

If no such sequence of operations exists, print No.

Otherwise, print Yes, followed by $n$ lines. On each line, print the two integers selected from $s$ for the corresponding operation.

If there are multiple possible answers, you may print any.

서브태스크

번호배점제한
150

$b=1$

250

No further constraints

예제 입력 1

2 1 1

예제 출력 1

Yes
1 4
2 3

예제 입력 2

4 4 6

예제 출력 2

No

예제 입력 3

3 995069485 940582184

예제 출력 3

Yes
3816816037 4757398221
5697980405 1935651669
2876233853 995069485

노트

Two integers are said to be coprime if the only positive integer that divides both of them is $1$.

출처

University > KAIST > 2023 KAIST RUN Spring Contest A번

채점 및 기타 정보

  • 예제는 채점하지 않는다.