Time limit: 1s
Memory limit: 64MB
Input:
Output:
Two plus two is four. Minus one, that's three, quick maths.
Task
Given an array of integers, such that , determine if there are three numbers in the array that add up to zero. Since this problem seems quite straightforward, you will need to answer this question for such arrays.
Input data
The first line contains , the number of test cases. Each test case will contain , the number of values in the array, on the first line. The following line will contain the values of the array.
Output data
For each test case, print DA
(yes in Romanian) if you can find three values that sum up to , or NU
(no in Romanian) otherwise.
Constraints and clarifications
- ;
- ;
- .
# | Points | Constraints |
---|---|---|
1 | 32 | |
2 | 29 | |
3 | 39 | No additional constraints |
Example
stdin
4
6
7 9 12 -6 -9 -6
8
12 15 13 -16 -9 -8 12 14
7
-9 -8 -14 12 7 11 7
12
-13 -24 18 15 14 14 17 -19 -21 -23 -18 14
stdout
DA
NU
DA
NU
Explanation
For the first example, we can get the sum by summing , , and .
For the third example, we can get the sum by summing , , and .