Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- #define pb push_back
- int main()
- {
- _test
- {
- int n;
- cin>>n;
- vector<int> a(n);
- int m = n/2;
- a[m] = 1;
- if(n == 1)
- {
- for(auto e: a)
- cout<<e<<" ";
- cout<<"\n";
- continue;
- }
- if(n==2)
- {
- a[0] = 2;
- for(auto e: a)
- cout<<e<<" ";
- cout<<"\n";
- continue;
- }
- a[0] = 2;
- a[n-1] = 3;
- for(int i=1, x=4; i<n-1; i++)
- {
- if(i == m) continue;
- a[i] = x++;
- }
- for(auto e: a)
- cout<<e<<" ";
- cout<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment