Find Pairs

3.8

15 votes
Basic Programming
Problem

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

  • LA[i]+A[j]R
  • A[i]A[j] is odd where  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

1N1051LR10181A[i]1018

 

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Following unordered pairs satisfy the above conditions:

  • (1,2)
  • (1,4)
  • (2,3)
  • (3,4)
Editor Image

?