Respected sir/ma’am,
I guess this question has lesser details in it, as it is mentioned that x can be any number from 0 to 2 to the power 30, but if we carefully observe that it is not mentioned that x can’t take values of a, b or c. But for a test case a=1, b=3, c=2 we can see that if x is considered to be 1 then it satisfies the condition given in question which is (A⊕X)<(B⊕X)<(C⊕X) which implies that (1^1)<(1^3)<(1^2) which implies that 0<2<3 which is true. But the test cases accept -1 as answer for it.
Also the question is not accepting anything other than 0 for the condition where a, b and c are sorted in ascending order which contradicts tthe question which says that we have to output any value of x.
Kindly look nto the matter as I submitted the correct solution almost 1 and half hour before contest ends but despite of my solution being correct, it was given incorrect, which brought me a little disappointment in me. Due to this I couldn’t attempt 4th question and my rank won’t increase now, how it would have been.
I hope you look into the matter personally and as soon as possible. My code is attached below.
Yours sincerely,
Tanmayee Gosavi.
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
long long int a,b,c;
cin>>a>>b>>c;
if(a<b && b<c){
long long int temp=log2(c)+1;
cout<<pow(2,temp)<<endl;
}
else if((a>b && b<c) || (a<b && b>c)){
if(((a^a)<(a^b)) && ((a^b)<(a^c))){
cout<<a<<endl;
}
else {
cout<<-1<<endl;
}
}
else if(a>b && b>c){
long long int temp=log2(a)+1;
cout<<pow(2,temp)-1<<endl;
}
else{
cout<<-1<<endl;
}
}
return 0;
}