302522: CF487C. Prefix Product Sequence
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Prefix Product Sequence
题意翻译
题目描述 是否存在一个长度为$n$的排列,使得其前缀积在$mod\,n$意义下两两不同? 输入 一行一个正整数$n(1 \leq n \leq 10^5)$ 输出 如果存在,输出一行$YES$,接下来$n$行每行一个数表示这个排列;如果不存在,输出一行$NO$题目描述
Consider a sequence $ \[a_{1},a_{2},... ,a_{n}\] $ . Define its prefix product sequence ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF487C/ff8116fff58c431c0df2f0dc70c6d2a466564b92.png). Now given $ n $ , find a permutation of $ \[1,2,...,n\] $ , such that its prefix product sequence is a permutation of $ \[0,1,...,n-1\] $ .输入输出格式
输入格式
The only input line contains an integer $ n $ ( $ 1<=n<=10^{5} $ ).
输出格式
Consider a sequence $ \[a_{1},a_{2},... ,a_{n}\] $ . Define its prefix product sequence ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF487C/ff8116fff58c431c0df2f0dc70c6d2a466564b92.png). Now given $ n $ , find a permutation of $ \[1,2,...,n\] $ , such that its prefix product sequence is a permutation of $ \[0,1,...,n-1\] $ .
输入输出样例
输入样例 #1
7
输出样例 #1
YES
1
4
3
6
5
2
7
输入样例 #2
6
输出样例 #2
NO