can anyone help me with this code
include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
int arr[n+1];
for(int i = 0;i<=n;i++)
{
cin>>arr[i];
}
int comparator = arr[0];
int a = 0;
int b = 0;
int c = 0;
int z = 1;
while(z<=n)
{
int diff = arr[z] - arr[0];
if(diff>0)
{
if(diff>=3*z)
{
z = z<<1;
continue;
}else if(diff>=z)
{
a = a|z;
}
}else if(diff<0)
{
if(diff<=(-3*z))
{
a = a|z;
b = b|z;
c = c|z;
}else if( diff<=(-z))
{
a = a|z;
b = b|z;
}
}
z = z<<1;
}
cout<<a<<" "<<b<<" "<<c<<" "<<endl;
}
return 0;
}
I am getting right answer only but it is showing wrong answer for the 3rd sample testcase I am getting 7 1 1 it is correct accroding to the problem description