Advertisement
TawratNibir

Untitled

Nov 17th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int main()
  5. {
  6.     ll t;
  7.     cin >> t;
  8.     while(t--) {
  9.         ll n;
  10.         cin >> n;
  11.         if(n<5) {
  12.             cout << -1 << endl;
  13.             continue;
  14.         }
  15.         ll p = n - !(n%2);
  16.         for(int i=1;i<=p;i++) {
  17.             if(i%2==1) {
  18.                 cout << i << ' ';
  19.             }
  20.         }
  21.         ll q;
  22.         if(p%3==0) q = 6;
  23.         if(p%3==2) q = 4;
  24.         if(p%3==1) q = 2;
  25.         cout << q << ' ';
  26.         for(int i=2;i<=n;i++) {
  27.             if(i%2==0&&i!=q) {
  28.                 cout << i << ' ';
  29.             }
  30.         }
  31.         cout << endl;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement