Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- #include <ext/pb_ds/tree_policy.hpp>
- using namespace std;
- using namespace __gnu_pbds;
- using u64 = uint64_t;
- using u128 = __uint128_t;
- #define ll long long
- #define ull unsigned long long
- #define ld long double
- #define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
- #define ordered_set tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>
- const int N = 5e5 + 5, M = 1e3 + 5, hb = 127, LOG = 25;
- const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
- const int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};
- const ld PI = acos(-1), EPS = 1e-6;
- const ll MOD1 = 1e9 + 7, MOD2 = 998244353, OO = 1e15;
- ll inv(ll a, ll b = MOD1)
- {
- return 1 < a ? b - inv(b % a, a) * b / a : 1;
- }
- void solve()
- {
- ll n;
- cin >> n;
- if (n % 2)
- {
- if (n <= 25)
- {
- cout << "-1\n";
- return;
- }
- ll pos[n + 1] = {};
- pos[1] = pos[17] = pos[26] = 1;
- int j = 2;
- for (int i = 2; i <= 13; i += 2)
- {
- pos[i] = pos[i + 1] = j++;
- }
- pos[16] = pos[15] = j++;
- pos[18] = pos[14] = j++;
- pos[27] = pos[23] = j++;
- pos[24] = pos[25] = j++;
- pos[22] = pos[21] = j++;
- pos[20] = pos[19] = j++;
- for (int i = 28; i <= n; i += 2)
- {
- pos[i] = pos[i + 1] = j++;
- }
- for (int i = 1; i <= n; i++)
- {
- cout << pos[i] << ' ';
- }
- }
- else
- {
- for (int i = 1; i <= n / 2; i++)
- {
- cout << i << ' ' << i << ' ';
- }
- }
- cout << '\n';
- return;
- }
- int main()
- {
- IO;
- // freopen("input.txt", "r", stdin);
- // freopen("output.txt", "w", stdout);
- int t = 1;
- cin >> t;
- while (t--)
- {
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment