Public Judge

pjudge

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#21759. 【PR #9】排列

Statistics

给定正整数 $n$, 请你构造 $0\sim n-1$ 的排列 $a_0,\ldots,a_{n-1}$ 使得由 $b_i:=|a_i-i|$ 定义的序列 $b_0,\ldots,b_{n-1}$ 也是 $0\sim n-1$ 的排列, 需判断无解.

输入格式

一行, 一个正整数 $n$.

输出格式

若无解则输出一行, 一个字符串 NO.

否则第一行输出字符串 YES, 第二行 $n$ 个非负整数 $a_0,\ldots,a_{n-1}$ 表示你构造的排列 $a$.

若有多组解, 你可以输出任意一种.

样例一

input

1

output

YES
0

样例二

input

3

output

NO

样例三

input

4

output

YES
3 0 2 1

数据范围

本题共 $25$ 个测试点, 各占 $4$ 分. 对于所有数据, $n\le 10^6$.

  • 对于第 $1\sim 7$ 个测试点, $n$ 分别为 $114514,206669,265720,324765,620012,797161,974304$.
  • 对于第 $8\sim 10$ 个测试点, $n\equiv 0\pmod{12}$.
  • 对于第 $11\sim 13$ 个测试点, $n\equiv 1\pmod{12}$.
  • 对于第 $14\sim 16$ 个测试点, $n\equiv 4\pmod{12}$.
  • 对于第 $17\sim 19$ 个测试点, $n\equiv 5\pmod{12}$.
  • 对于第 $20\sim 22$ 个测试点, $n\equiv 8\pmod{12}$.
  • 对于第 $23\sim 25$ 个测试点, $n\equiv 9\pmod{12}$.
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.