-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwo_set.cpp
More file actions
50 lines (45 loc) · 1.22 KB
/
Copy pathtwo_set.cpp
File metadata and controls
50 lines (45 loc) · 1.22 KB
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
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
int main (int argc, char** argv) {
// n mod 4 = 0 or 3
int n, first_i, second_i;
cin >> n;
vector<int> first, second;
if (n % 4 == 1 || n % 4 == 2) {
cout << "NO";
return 0;
} else if (n % 4 == 0) {
first_i = n / 2;
second_i = n / 2;
for (int i = 0; i < n / 4; i++) {
first.push_back(i * 4 + 1);
first.push_back(i * 4 + 4);
second.push_back(i * 4 + 2);
second.push_back(i * 4 + 3);
}
} else {
first_i = n / 2 + 1;
second_i = n / 2;
first.push_back(1);
first.push_back(2);
second.push_back(3);
for (int i = 0; i < n / 4; i++) {
first.push_back(i * 4 + 1 + 3);
first.push_back(i * 4 + 4 + 3);
second.push_back(i * 4 + 2 + 3);
second.push_back(i * 4 + 3 + 3);
}
}
cout << "YES\n" << first_i << "\n";
for (int i = 0; i < first_i; i++) {
cout << first[i] << " ";
}
cout << "\n" << second_i << "\n";
for (int i = 0; i < second_i; i++) {
cout << second[i] << " ";
}
cout << "\n";
return 0;
}