Skip to content

Commit cef7ff2

Browse files
cses
1 parent 61ba8a2 commit cef7ff2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

CSES/1070.cpp

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include "bits/stdc++.h"
2+
using namespace std;
3+
#define ll long long int
4+
#define endl "\n"
5+
6+
int main()
7+
{
8+
ll i, n;
9+
cin >> n;
10+
11+
if(n == 2 || n == 3)
12+
{
13+
cout << "NO SOLUTION" << endl;
14+
}
15+
else
16+
{
17+
if(n == 4)
18+
{
19+
cout << "3 1 4 2" << endl;
20+
}
21+
for(i = n; i >= 1; i -= 2)
22+
{
23+
cout << i << " ";
24+
}
25+
for(i = n - 1; i >= 1; i -= 2)
26+
{
27+
cout << i << " ";
28+
}
29+
cout << endl;
30+
}
31+
return 0;
32+
}

0 commit comments

Comments
 (0)