TR001...what was my mistake??

int main()
{
long long int n,m,t,x;
cin>>t;
while(t–)
{
cin>>n>>m;
if(n>=m)
{

		x=(n/2);
		cout<<x<<"\n";
	}
	else
	{
		x=(m/2);
		cout<<x<<"\n";
	}
	
	

	
}
return 0;

}

1 Like

@chaseme your logic is incorrect.

In Question mentioned " the minimum number of boxes he would have to open in the worst case scenario to infer the position of the box that contains Modak."

so given N*M matrix we will take maximum of (N,M)

Then answer will be simple (int)math.log(max(N,M),2)

//