-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwo_sets.cpp
More file actions
58 lines (45 loc) · 847 Bytes
/
Copy pathtwo_sets.cpp
File metadata and controls
58 lines (45 loc) · 847 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <bits/stdc++.h>
using namespace std;
long n;
long tot;
/*
1 - odd
2 - odd
3 - even
4 - even
5 - odd
6 - odd
7 - even
8 - even
*/
// 1 2 3 4 5 6 7
int main() {
cin >> n;
tot = 1l * (n) * (n + 1) / 2;
if (tot % 2 != 0) {
cout << "NO";
return 0;
}
cout << "YES" << endl;
vector<int> g1;
vector<int> g2;
if (n % 2) {
g2.push_back(n--);
}
for (int i = 1; i <= n/2; i++) {
if (i & 1) {
g1.push_back(i);
g1.push_back(n - i + 1);
}
else {
g2.push_back(i);
g2.push_back(n - i + 1);
}
}
cout << g1.size() << endl;
for (int i : g1) cout << i << " ";
cout << endl;
cout << g2.size() << endl;
for (int i : g2) cout << i << " ";
return 0;
}