아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Simple Game

면접 대비

시간 제한1초메모리 제한1024 MB

요약
등차수열의 2n개 항을 서로소인 정수 n쌍으로 짝지어 출력하거나, 불가능하면 No를 출력한다.
난이도

보통10점 중 6점

유형
수학, 정수론, 그리디
정답자
아직 제출이 없습니다

문제

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

You should perform a sequence of nn operations, where each operation involves selecting two coprime integers from ss and erasing them. Once an integer is erased from ss, 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,bn, a, b. (1≤n≤1051 \leq n \leq 10^5, 1≤a,b≤1091 \leq a, b \leq 10^9)

출력

If no such sequence of operations exists, print No.

Otherwise, print Yes, followed by nn lines. On each line, print the two integers selected from ss for the corresponding operation.

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

힌트

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

예제3

  1. 예제 1

    입력
    2 1 1
    
    예상 출력
    Yes
    1 4
    2 3
    
  2. 예제 2

    입력
    4 4 6
    
    예상 출력
    No
    
  3. 예제 3

    입력
    3 995069485 940582184
    
    예상 출력
    Yes
    3816816037 4757398221
    5697980405 1935651669
    2876233853 995069485