-
-
Save enzerr/0cf7768f8e82750439a9b589a90168f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
#define int long long | |
vector<int> ans1, ans2; | |
int32_t main(){ | |
ios::sync_with_stdio(false); | |
int n; cin >> n; | |
int sum = (n*n+n)/2; | |
if(sum%2) {cout << "NO\n"; return 0;} | |
sum/=2; | |
if(n%2){ | |
for(int i = 1; i <= (n+1)/4; i++){ | |
ans1.push_back(i); | |
ans1.push_back(n-i); | |
} | |
for(int i = ((n+1)/4)+1; i <= n/2; i++){ | |
ans2.push_back(i); | |
ans2.push_back(n-i); | |
} | |
ans2.push_back(n); | |
} | |
else{ | |
for(int i = 1; i <= n/4; i++){ | |
ans1.push_back(i); | |
ans1.push_back(n-i+1); | |
} | |
for(int i = (n/4)+1; i <= n/2; i++){ | |
ans2.push_back(i); | |
ans2.push_back(n-i+1); | |
} | |
} | |
cout << "YES\n"; | |
cout << ans1.size() << '\n'; | |
for(int x : ans1) cout << x << " "; | |
cout << '\n'; | |
cout << ans2.size() << '\n'; | |
for(int x : ans2) cout << x << " "; | |
cout << '\n'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment