-
Notifications
You must be signed in to change notification settings - Fork 0
/
1092.cpp
55 lines (44 loc) · 933 Bytes
/
1092.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
49
50
51
52
53
54
55
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n;
cin >> n;
ll s = n * (n + 1) / 2;
if(s % 2 == 0 && s > 2)
{
cout << "YES\n";
vector<ll> set1, set2;
ll m = s / 2;
for(ll i = n; i > 0; i--)
{
if(m >= i)
{
set1.push_back(i);
m -= i;
}
else
{
set2.push_back(i);
}
}
cout << set1.size() << "\n";
for(int i = 0; i < set1.size(); i++)
{
cout << set1[i] << " ";
}
cout << "\n";
cout << set2.size() << "\n";
for(int i = 0; i < set2.size(); i++)
{
cout << set2[i] << " ";
}
}
else
{
cout << "NO";
}
cout << "\n";
return 0;
}