#K66047. Sum Compliant Check
Sum Compliant Check
Sum Compliant Check
Given an array of integers and a target integer \(T\), determine whether there exists a pair of distinct elements \(a\) and \(b\) such that:
\(a + b = T\)
If such a pair exists, output sum-compliant
; otherwise, output sum-noncompliant
. The input consists of multiple test cases, and you should process each test case independently.
Note: Each test case begins with an integer representing the number of elements in the array.
inputFormat
The first line of the input contains an integer \(T\) denoting the number of test cases. For each test case, the input is given in the following format:
- The first line contains an integer \(n\), the number of elements in the list.
- The second line contains \(n\) space-separated integers.
- The third line contains an integer \(target\), the target sum.
outputFormat
For each test case, print a single line with the output string: either sum-compliant
if a pair exists whose sum equals the target, or sum-noncompliant
if no such pair exists.
3
4
1 2 3 4
5
5
1 1 1 1 1
2
6
-5 -4 -3 -2 -1 0
-10
sum-compliant
sum-compliant
sum-noncompliant
</p>