Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef double dl;
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- ll n;
- cin >> n;
- if (n == 1) {
- cout << 1;
- }
- else if (n < 4) cout << "NO SOLUTION";
- else {
- ll* p = new ll[n];
- ll i = 0;
- ll x = 0;
- ll z = 0;
- ll j = n / 2;
- for (i = 0; i < n; ++i) {
- ++x;
- if (x % 2) {
- p[j] = x;
- ++j;
- }
- else {
- p[z] = x;
- ++z;
- }
- }
- for (i = 0; i < n; ++i) {
- cout << p[i] << " ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement