fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. vector<int> v,p;
  8. if(n%2==0)
  9. {
  10. for(int i=0;i<n;i++)
  11. {
  12. if((i+1)%2==0)
  13. {
  14. v.push_back(i+1);
  15. }
  16. else p.push_back(i+1);
  17. }
  18. for(int i=0;i<n;i++)
  19. {
  20. if((i+1)%2==1)
  21. {
  22. cout << v[i] << " ";
  23. }
  24. else
  25. {
  26. cout << p[i] << " ";
  27. }
  28. }
  29. cout << endl;
  30.  
  31. }
  32. else
  33. {
  34. cout << "impossible'" << endl;
  35. }
  36. return 0;
  37. }
Success #stdin #stdout 0s 5320KB
stdin
4
stdout
2 3 0 0