if i ignore the test cases i solved the question in O(1) but still i am getting tle?
soln dikha apna , I got Ac in it , I did precomputation and did
#include<bits/stdc++.h>
using namespace std;
int main() {
long t;
cin>>t;
while(t--) {
long n;
cin>>n;
long ans = 0;;
long x = n % 4;
if(x == 0) ans = n;
else if(x == 1) ans = 1;
else if(x == 2) ans = n + 1;
else if(x == 3) ans = 0;
cout<<ans<<endl;
}
return 0;
}
its not unnecessary tle
u have missed very one imp thing
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
write this line before taking input
when input files are large then u get TLE if u dont include this line
But i have never used this before and my solutions got accepted even for larger inputs than this
i m telling u to use it whether files large or not.
For efficiency