tay
Giới thiệu
include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int sum = n * (n + 1) / 2;
if (sum % 2 != 0) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
vector<int> set1, set2;
sum /= 2;
for (int i = n; i >= 1; i--) {
if (i <= sum) {
set1.push_back(i);
sum -= i;
} else {
set2.push_back(i);
}
}
cout << set1.size() << endl;
for (int i = 0; i < set1.size(); i++) {
cout << set1[i] << " ";
}
cout << endl;
cout << set2.size() << endl;
for (int i = 0; i < set2.size(); i++) {
cout << set2[i] << " ";
}
}
return 0;
}