Find Pairs
Practice
3.8 (15 votes)
Basic programming
Problem
18% Success 5478 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Given an array \(A\) of \(N \) integers. Find the number of unordered pairs \((i,j)\)\(1 \leq i, j \leq N\) such that 

  • \(L \le A[i] + A[j] \le R\)
  • \(A[i] \oplus A[j]\) is odd where \(\oplus\) represents bitwise XOR operation.

Input format

  • The first line contains three space-separated integers \(N \ L \ R\).
  • The next line contains \(N\) space-separated integers denoting the array \(A\)

Output format

Print the number of unordered pairs \((i,j)\) which satisfy the above conditions in a new line.

Constraints

\(1 \le N \le 10^5 \\ 1 \le L \le R \le 10^{18} \\ 1 \le A[i] \le 10^{18} \)

 

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
8 votes
Tags:
ApprovedBasic ProgrammingBasics of ImplementationEasyGrammar-VerifiedImplementationMapsReadyRecruitSets
Points:20
58 votes
Tags:
ApprovedEasyImplementationOpen
Points:20
25 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation