https://www.codechef.com/viewsolution/1039834600
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main() {
int t;cin>>t;
while(t--){
int n;cin>>n;
for(ll i=1;i<=n;i++)cout<<i<<" ";
cout<<endl;
for(ll i=1;i<=n;i++){
cout<<131072+i<<" ";
}
cout<<endl;
}
return 0;
}
@vanshwari
here plzz refer my c++ code for better understanding of the logic
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int val=2;
for(int i=0;i<n;i++)
{
cout<<val<<" ";
val++;
}
if(n%2)
val++;
cout<<endl;
for(int i=0;i<n;i++)
{
cout<<val<<" ";
val++;
}
cout<<endl;
}
}
i understand your logic but i want to ask what is wrong with my logic i added 2^17 to no. 1 to n so xor will be equal for even index. and no number will be repeated