GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Thursday 26 May 2022

[Solution] Good Pairs CodeChef Solution | CodeChef Problem Solution 2022

Chef has two arrays A and B, each of length N.

A pair (i,j) (1i<jN) is said to be a good pair if and only if

AiAj=BiBj

Here,  denotes the bitwise XOR operation.

Determine the number of good pairs.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases. The description of the test cases follows.
Solution Click Below:-  CLICK HERE

  • Each test case consists of three lines of input:
    • The first line contains a single integer N — the size of the arrays A and B.
    • The second line contains N space-separated integers A1,A2,,AN — the elements of array A.
    • The third line contains N space-separated integers B1,B2,,BN — the elements of array B.

Output Format

  • For each test case, output on a new line the number of good pairs.

Constraints

  • 1T105
  • 2N3105
  • The sum of N over all test cases does not exceed 3105

No comments:

Post a Comment