-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetsTwo.cpp
More file actions
53 lines (51 loc) · 1.05 KB
/
SetsTwo.cpp
File metadata and controls
53 lines (51 loc) · 1.05 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
#include <iostream>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#define lli long long int
#define li long int
#define ld long double
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli n;
cin >> n;
lli total = n * (n + 1) / 2;
if (total & 1)
{
//cout<<(total & 1)<<endl<<endl<<endl;
cout << "NO";
}
else
{
cout << "YES" << endl;
vector<lli> arr1, arr2;
total /= 2LL;
//cout<<total<<endl<<endl<<endl;
//printf(total);
while (n)
{
if (total - n >= 0)
{
arr1.push_back(n);
total -= n;
}
else
{
arr2.push_back(n);
}
n--;
}
cout << arr1.size() << endl;
for (li ele : arr1)
cout << ele << " ";
cout << endl;
cout << arr2.size() << endl;
for (li ele : arr2)
cout << ele << " ";
}
return 0;
}