-
Notifications
You must be signed in to change notification settings - Fork 0
/
05-permutations.cpp
40 lines (32 loc) · 938 Bytes
/
05-permutations.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define endl '\n'
#define pb push_back
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ii = pair<int,int>;
using iii = tuple<int,int,int>;
const int inf = 2e9+1;
const int mod = 1e9+7;
const int maxn = 3e5+100;
template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }
void solve(){
int n; cin>>n;
if(n<=3&&n!=1)cout<<"NO SOLUTION"<<endl;
else {
for(int i=2; i<=n; i+=2)
cout<<i<<" ";
for(int i=1; i<=n; i+=2)
cout<<i<<" ";
cout<<endl;
}
}
int main(){_
//freopen("in.in", "r", stdin);
//freopen("out.out", "w", stdout);
solve();
}