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

21061번 - Beautiful Permutation 스페셜 저지다국어

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

문제

A permutation $a_0, a_1, \ldots, a_{n - 1}$ of 0,ドル 1, \ldots, n - 1$ is said to be beautiful if the sequence $b_0, \ldots, b_{n - 1}$ defined as $b_i = |a_i - i|$ is also a permutation of 0,ドル \ldots, n - 1$.

Given $n,ドル construct a beautiful permutation of $n$ elements or determine that it does not exist.

입력

The first line contains a single integer $n$ (1ドル \leq n \leq 10^6$): the size of the permutation.

출력

If there is no beautiful permutation of $n$ elements, output a single line with the word "NO".

Otherwise, on the first line, print "YES", and on the second line, print $n$ space-separated integers $a_0, \ldots, a_{n-1}$: the beautiful permutation. If there are multiple beautiful permutations, print any one of them.

제한

예제 입력 1

4

예제 출력 1

YES
3 0 2 1

예제 입력 2

3

예제 출력 2

NO

예제 입력 3

1

예제 출력 3

YES
0

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2021 > Day 2: UPC Contest B번

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

출처

대학교 대회

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

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