1. Find the point X in the range [L...R] s.t. F is maximum at X. (There can be multiple values X)
2. Try to reduce X maximum possible inside range [L....R]. Keeping the value of F constant
#include<bits/stdc++.h>
using namespace std;
int msbPos(long long int n)
{
int msb_p = -1;
while (n)
{
n = n>>1;
msb_p++;
}
return msb_p;
}
main(){
long long int t;
cin>>t;
while(t–){
int i;
long long int l,r,x,y;
cin>>x>>y>>l>>r;
if(x==0 || y==0){
cout<<0<<endl;
}
else{
string a =bitset<1000>(x).to_string();
string b= bitset<1000>(y).to_string();
@harshil21
Can anyone please check my solution? I am targetting only the first 2 subtasks, 1st subtask is correct and 2nd is wrong.
I have tried each and every test case mentioned above by HARSHIL sir.
Please suggest https://www.codechef.com/viewsolution/33037995