Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- if (n == 1) {
- cout << "1";
- return 0;
- }
- if (n <= 3) {
- cout << "NO SOLUTION";
- return 0;
- }
- vector<int> permutation;
- for (int i = 2; i <= n; i += 2) {
- permutation.push_back(i);
- }
- for (int i = 1; i <= n; i += 2) {
- permutation.push_back(i);
- }
- for (int i = 0; i < n; ++i) {
- cout << permutation[i] << " ";
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement