OP 14 May, 2022 - 07:51 PM
Your are given an array A with size N. A pair of P and Q will be considered "accepted" if the following conditions are valid:
Example
Assumptions
There are two accepted pairs:
- P and Q are non-empty sub-sequences of array A of equal length
- Summation of (Pi + Qi) = X
- Summation of (Pi - Qi) = Y
- Summation is taken over all elements of P and Q
Example
Assumptions
- T = 1
- N = 3
- X = 4
- Y = 2
- A = [3, 1, 1]
There are two accepted pairs:
- P=[3] for 3 at index 1 and Q=[1] for 1 at index 2, (3+1) will be 4(equals to X) and (3-1) will be 2(equals to Y)
- P=[3] for 3 at index 1 and Q=[1] for 1 at index 3, (3+1) will be 4(equals to X) and (3-1) will be 2(equals to Y)