1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| #include <bits/stdc++.h> #define int long long #define N 1000005 #define IOS ios::sync_with_stdio(0),cin.tie(0) using namespace std; int n; signed main(){ IOS; cin>>n; bool vis[N];memset(vis,0,sizeof(vis)); if(n == 2 || n == 3)cout<<"NO SOLUTION"<<endl; else if(n == 4)cout<<"2 4 1 3 "; else{ for(int i=1;i<=n;i+=2){ cout<<i<<" "; vis[i] = 1; } for(int i=1;i<=n;i++){ if(vis[i] == 0)cout<<i<<" "; } } cout<<endl; }
|