-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1092 - Two Sets.cpp
More file actions
30 lines (28 loc) · 794 Bytes
/
1092 - Two Sets.cpp
File metadata and controls
30 lines (28 loc) · 794 Bytes
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
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, sum;
cin >> n;
sum = n * (n + 1) / 2;
if (sum & 1)
cout << "NO\n";
else if (n % 4 == 0) {
cout << "YES\n";
cout << n / 2 << "\n";
for (int i = 1; i <= n / 2; i += 2) cout << i << " " << n - i + 1 << " ";
cout << "\n";
cout << n / 2 << "\n";
for (int i = 2; i <= n / 2; i += 2) cout << i << " " << n - i + 1 << " ";
cout << "\n";
} else {
cout << "YES\n";
cout << (n + 1) / 2 << "\n";
for (int i = 1; i <= n / 2; i += 2) cout << i << " " << n - i << " ";
cout << "\n";
cout << n / 2 << "\n";
for (int i = 2; i <= n / 2; i += 2) cout << i << " " << n - i << " ";
cout << n << " "
<< "\n";
}
return 0;
}