-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwo_sets.cpp
More file actions
49 lines (48 loc) · 822 Bytes
/
Copy pathtwo_sets.cpp
File metadata and controls
49 lines (48 loc) · 822 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
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
#ifndef DEBUG
ios::sync_with_stdio(false);
cin.tie(nullptr);
#endif
ll n;
cin>>n;
ll i=0;
ll sum=0;
ll count=0;
ll s=n*(n+1)/2;
if(s%2)
{
printf("NO\n");
}
else
{
s/=2;
cout<<"YES\n";
while(sum<s)
{
sum+=n-count;
count++;
}
sum-=n-count+1;
i=s-sum;
cout<<count<<"\n";
for(int i=0;i<count-1;i++)
{
cout<<n-i<<" ";
}
cout<<i<<"\n";
cout<<n-count<<"\n";
for(int k=1;k<=n-count+1;k++)
{
if(k==i)
{
continue;
}
cout<<k<<" ";
}
}
return 0;
}