-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTwo_Sets.cpp
More file actions
61 lines (61 loc) · 1.38 KB
/
Two_Sets.cpp
File metadata and controls
61 lines (61 loc) · 1.38 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
51
52
53
54
55
56
57
58
59
60
61
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(int n){
int sum=n*(n+1)/2;
vector<ll> a,b;
if(sum%2==0){
cout<<"YES"<<endl;//1st
if(n%2==0){
cout<<n/2<<endl;
for(int i=1;i<=n/4;i++){
cout<<i<<" ";
}
for(int i=n;i>n-(n/4);i--){
cout<<i<<" ";
}
cout<<endl;
cout<<n/2<<endl;
for(int i=(n/4)+1;i<=n-(n/4);i++){
cout<<i<<" ";
}
cout<<endl;
}
else{
int count=0;
for(int i=1;i<=n;i++){
if(count<2){
a.push_back(i);
count++;
}
else if(count>=2 and count<4){
b.push_back(i);
count++;
}
if(count==4) count=0;
}
cout<<a.size()<<endl;//3rd
for(int i=0;i<a.size();i++){
cout<<a[i]<<" ";//4th
}cout<<endl;
cout<<b.size()<<endl;//5th
for(int i=0;i<b.size();i++){
cout<<b[i]<<" ";
}cout<<endl;
}
}
else{
cout<<"NO"<<endl;
}
}
int main(){
ll t;
//cin>>t;
t=1;
while(t--){
int n;
cin>>n;
solve(n);
}
return 0;
}