Logo
(追記) (追記ここまで)

21262번 - K Co-prime Permutation 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB95714475.862%

문제

Kotori is very good at math (really?) and she loves playing with permutations and primes.

One day, she thinks of a special kind of permutation named $k$ co-prime permutation. A permutation $p_1,p_2,\cdots,p_n$ of $n$ is called a $k$ co-prime permutation of $n$ if there exists exactly $k$ integers $i$ such that 1ドル \le i \le n$ and $\text{gcd}(p_i,i)=1,ドル where $\text{gcd}(x,y)$ indicates the greatest common divisor of $x$ and $y$.

Given $n$ and $k,ドル please help Kotori construct a $k$ co-prime permutation of $n$ or just report that there is no such permutation.

Recall that a permutation of $n$ is a sequence of length $n$ containing all integers from 1ドル$ to $n$.

입력

There is only one test case in each test file.

The first and only line contains two integers $n$ and $k$ (1ドル \le n \le 10^6,ドル 0ドル \le k \le n$).

출력

Output one line containing $n$ integers $p_1, p_2, \cdots, p_n$ separated by one space, indicating the permutation satisfying the given constraints. If no such permutation exists output "-1" (without quotes) instead. If there are multiple valid answers you can print any of them.

Please, DO NOT output extra spaces at the end of each line, otherwise your answer may be considered incorrect!

제한

예제 입력 1

5 3

예제 출력 1

1 4 5 2 3

예제 입력 2

1 0

예제 출력 2

-1

힌트

출처

Contest > Open Cup > 2020/2021 Season > Stage 9: Grand Prix of Nanjing, Division 1 K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /