-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcses_1092.cpp
More file actions
41 lines (39 loc) · 837 Bytes
/
cses_1092.cpp
File metadata and controls
41 lines (39 loc) · 837 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
#include <iostream>
#include <vector>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int64_t n;
cin >> n;
int64_t tmp = ((1 + n) * n) >> 1;
if (tmp & 1)
cout << "NO\n";
else
{
tmp >>= 1;
vector<bool> a(n + 1, false);
int cnt = 0;
for (int i = n; i > 0; i--)
{
if (i <= tmp)
{
cnt++;
a[i] = true;
tmp -= i;
}
}
cout << "YES\n";
cout << cnt << '\n';
for (int i = 1; i <= n; i++)
if (a[i])
cout << i << ' ';
cout << '\n' << n - cnt << '\n';
for (int i = 1; i <= n; i++)
if (!a[i])
cout << i << ' ';
cout << '\n';
}
return 0;
}