Where is mentioned that the pairs are always o-o or e-e or o-e :\

that can be the case when pairs are mixed as well …then it should be mentioned properly i guess

Hi I dont think I was able to understand your problem fully. Can you please explain what the issue is exactly. What I am getting from your doubt right now is that pairs were not mentioned to be always odd-odd or even-even or odd-even. However it has been mentioned in the question that size of left shoe is not always equal to the right shoe and these 3 are the only combinations possible (odd-even counting for even-odd as well).

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

can you tell me where i am wrong?? :\


u can look at this, this is the correct code
ur checking conditions are faulty
and ur not using mod

sir mod liya hai meine , solve function mei return ans % mod likha hai … and abh bhi wrong ans aara hai

?? anyone , help please ??

Hi Muskan
I just checked your code and compared it with Seemant’s code
Apparently you need to take a mod at each step of the operation as you are dealing with long numbers here and even simple operations can cause it to overflow. Hence try to make your solve function replicate the functionality of the power function in Seemant’s code.

import java.util.*;
public class Main {
public static void main (String args[]) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int oo=0;
		int ee=0;
		int oe=0;
		
		for(int i=0;i<n;i++) {
			int l=s.nextInt();
			int r=s.nextInt();
			if(l%2==0 && r%2==0) {
				ee++;
			}
			else if((l%2)!=0 && (r%2)!=0) {
				oo++;
			}else{
            oe++;
        }
		}
	
		int mod=1000000007;

		if(oe==0) {
        if(oo%2==0){
			 System.out.println("0");
        }else{
           int ans=solve(2,n,mod)%mod;
            System.out.println(ans);
        }
		}else {
			int ans=solve(2,n-1,mod)%mod;
			System.out.println(ans);
		}
	}
	public static int solve(int a,int b,int mod) {
		if (b == 0)
		    return 1;

	    int val = solve(a, b / 2,mod) % mod;
	    if (b % 2 == 0) {
		    return (val * val) % mod;
	    } else {
		    return (a % mod * (val * val) % mod) % mod;
	    }
	}
}

ohk but your code also giving wrong ans

i have pasted the same

anyone, problem in submission ??? :\

@Muskan-Gupta-598128740703036 let me check your code.