Saleh127

CSES 1092

Apr 17th, 2021
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. ll n,m,i,k;
  11.  
  12. vector<ll>a,b;
  13.  
  14. map<ll,ll>x;
  15.  
  16.  
  17. cin>>n;
  18.  
  19. k=(n*(n+1))/2;
  20.  
  21. if(k%2) cout<<"NO"<<endl;
  22. else
  23. {
  24. k=k/2;
  25.  
  26. cout<<"YES"<<endl;
  27. for(i=n;i>=1;i--)
  28. {
  29. if(i<=k)
  30. {
  31. a.push_back(i);
  32. k-=i;
  33. x[i]=1;
  34. }
  35. if(k==0) break;
  36. }
  37.  
  38. cout<<a.size()<<endl;
  39.  
  40. for(auto s:a)
  41. {
  42. cout<<s<<" ";
  43. }
  44. cout<<endl;
  45. cout<<n-a.size()<<endl;
  46.  
  47. for(i=1;i<=n;i++)
  48. {
  49. if(x[i]!=1) cout<<i<<" ";
  50. }
  51. cout<<endl;
  52. }
  53.  
  54.  
  55. return 0;
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment