Ankit_132

A

Jun 20th, 2024
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define ll long long int
  3. const int MOD = 1e9 + 7;
  4. using namespace std;
  5.  
  6. int main() {
  7.     ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
  8.     int test;cin>>test;
  9.     while(test--)
  10.     {
  11.         int n;cin>>n;
  12.         vector<int> a(n),b(n);
  13.        
  14.         for(int i=0;i<n;i++)
  15.         {
  16.             a[i]=i+1;
  17.         }
  18.         int i=n/2;
  19.         int j=1;
  20.         for(;i<n;i++)
  21.         {
  22.             b[i]=j++;
  23.         }
  24.         for(i=0;i<n/2;i++)
  25.         {
  26.             b[i]=j++;
  27.         }
  28.        
  29.         for(int i=0;i<n;i++)
  30.         {
  31.             cout<<a[i]<<" ";
  32.         }
  33.         cout<<endl;
  34.         for(int i=0;i<n;i++)
  35.         {
  36.             cout<<b[i]<<" ";
  37.         }
  38.         cout<<endl;
  39.     }
  40.  
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment