Advertisement
childast

Untitled

Dec 17th, 2017
160
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. #define por(i,a,b) for(i=a;i<b;i++)
  3. #define sf(R) scanf("%I64d",&R)
  4. #define pf(R) printf("%I64d",R)
  5. #define pb(x) push_back(x)
  6. #define ld long double
  7. #define mo 1000000007
  8. #define ll long long
  9. #define S second
  10. #define f first
  11. using namespace std;
  12.  
  13.  
  14. int main(){
  15. ll n;
  16. sf(n);
  17. ll t[n],t2[n];
  18. ll j=1,i,aux;
  19. ll c=1;
  20. if(n%2 ==0){
  21. por(i,0,n/2){
  22. t[i]=j;
  23. t2[i]=1+j;
  24. j+=2;
  25. }
  26. for(i=1;i<(n/2);i+=2){
  27. aux=t[i];
  28. t[i]=t2[i];
  29. t2[i]=aux;
  30. }
  31. if(n%4 == 0){
  32. cout<<"0\n";
  33. }else cout<<"1\n";
  34. cout<<n/2<<" ";
  35. por(i,0,n/2){
  36. cout<<t[i]<<" ";
  37. }
  38.  
  39. }else {
  40. j=2;
  41.  
  42. por(i,0,n/2){
  43. t[i]=j;
  44. t2[i]=1+j;
  45. j+=2;
  46. }
  47. for(i=1;i<(n/2);i+=2){
  48. aux=t[i];
  49. t[i]=t2[i];
  50. t2[i]=aux;
  51. }
  52. if((n-1)%4 == 0){
  53. cout<<"1\n";
  54. }else cout<<"0\n";
  55. cout<<n/2<<" ";
  56. por(i,0,n/2){
  57. cout<<t2[i]<<" ";
  58. }
  59.  
  60. }
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement