-
Notifications
You must be signed in to change notification settings - Fork 0
/
Two Sets.cpp
48 lines (43 loc) · 941 Bytes
/
Two Sets.cpp
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
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n;
cin >> n;
if(n*(n+1)/2%2){
cout << "NO";
return 0;
}
//n=0,3 mod 4
vector<int> v1, v2;
int j=0;
if(n%4)
j=3;
else
j=4;
for(int i=0; i<(n-1)/4; ++i){
v1.push_back(4*i+1+j);
v1.push_back(4*i+4+j);
v2.push_back(4*i+2+j);
v2.push_back(4*i+3+j);
}
if(n%4){
v1.push_back(1);
v1.push_back(2);
v2.push_back(3);
} else{
v1.push_back(1);
v1.push_back(4);
v2.push_back(3);
v2.push_back(2);
}
cout << "YES\n";
cout << v1.size() << "\n";
for(int i: v1)
cout << i << " ";
cout << "\n";
cout << v2.size() << "\n";
for(int i: v2)
cout << i << " ";
cout << " \n";
}