PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000166. Hoán vị đặc biệt (Special Permutation)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Hoán vị đặc biệt (Special Permutation)
Special Permutation
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer , construct any permutation of such that for every position .
Input
One line contains the integer .
Output
Print a permutation of with no fixed point.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
5
Output
2 3 4 5 1
Explanation
The permutation uses each value through once and differs from its index at all five positions.