-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path15_twoSets.cpp
More file actions
38 lines (38 loc) · 777 Bytes
/
15_twoSets.cpp
File metadata and controls
38 lines (38 loc) · 777 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
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n;
cin>>n;
ll t=n*(n+1)/2;
if(t%2==0)
{
cout<<"YES"<<endl;
vector<ll> arr1, arr2;
t /= 2;
while (n)
{
if (t - n >= 0)
{
arr1.push_back(n);
t -= n;
}
else
{
arr2.push_back(n);
}
n--;
}
cout << arr1.size() << endl;
for (ll ele : arr1)
cout << ele << " ";
cout << endl;
cout << arr2.size() << endl;
for (ll ele : arr2)
cout << ele << " ";
}
else
cout<<"NO"<<endl;
return 0;
}