-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSES Two_Sets.cpp
More file actions
111 lines (92 loc) · 2.24 KB
/
CSES Two_Sets.cpp
File metadata and controls
111 lines (92 loc) · 2.24 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include<bits/stdc++.h>
using namespace std;
using d = int;
using ll = long long;
using ud = unsigned int;
using ull = unsigned long long;
using lf = double;
using llf = long double;
using ch = char;
using st = string;
using bl = bool;
#define ci cin
#define co cout
#define fi( x, n ) for( d i = x; i < n; i++ )
#define fj( x, n ) for( d j = x; j < n; j++ )
#define fin( x, n ) for( d i = x; i <= n; i++ )
#define fjn( x, n ) for( d j = x; j <= n; j++ )
#define wh while
#define w( n ) while( n-- )
#define vd vector<d>
#define vll vector<ll>
#define vlf vector<lf>
#define vc vector<ch>
#define vs vector<st>
#define sd set<d>
#define sll set<ll>
#define slf set<lf>
#define sc set<ch>
#define ss set<st>
#define sz(x) x.size()
#define st(x) sort( x.begin(), x.end() )
#define cou(x, y) count( x.begin(), x.end(), y )
#define in insert
#define ct count
#define fd find
#define pb push_back
#define er erase
#define bg begin
#define en end
#define np next_permutation
#define el endl
void InputOutput()
{
#ifndef ONLINE_JUDGE
freopen("G:/Code/input.txt", "r", stdin);
freopen("G:/Code/output.txt", "w", stdout);
#endif
}
d main()
{
InputOutput();
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n;
cin >> n;
ll total = n * (n + 1) / 2;
if (total%2!=0)
{
cout << "NO";
}
else
{
cout << "YES" << endl;
vector<ll> arr1, arr2;
total /= 2;
while (n)
{
if (total - n >= 0)
{
arr1.push_back(n);
total -= n;
}
else
{
arr2.push_back(n);
}
n--;
}
cout << arr1.size() << endl;
for(int i=0;i<arr1.size();i++)
cout << arr1[i] << " ";
cout << endl;
cout << arr2.size() << endl;
for(int i=0;i<arr2.size();i++)
cout << arr2[i] << " ";
}
#ifndef ONLINE_JUDGE
cerr <<el<< "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#endif
return 0;
}