Tricky Array

All submissions for this problem are available.
You are given an array $A$ containing $N$ elements and the elements are denoted by $A[i]$ (*1<=i<=N*). The elements can be positive, negative or zero. An integer $X$ is also given. You have to perform the following operation exactly one time.  Add $X$ to $A[i]$ and subtract $X$ from $A[j]$ such that **i!= j** (i not equal to j). You have to perform the given operation in such a way that after the operation, the product of all the elements becomes greater than zero. If the product of all the elements is greater than zero after performing the given operation, print **“Happy New Year”** or else print **“1”** (without quotes). ###Input:  The first line contains a single integer $T$ denoting the number of test cases.  The first line of each test case contains two space separated integers $N$ and $X$.  The second line of each test case contains $N$ space separated integers represented by $A[i]$ (*1<=i<=N*) denoting the elements present in the array. ###Output: For each test case, print “**Happy New Year**” if the product of all the elements is greater than zero or else print “**1**” (without quotes) in a separate line. ###Constraints  $1 \leq T \leq 10$  $2 \leq N \leq 10^5$  $10^9 \leq A[i] \leq 10^9$  $1 \leq X \leq 10^9$ ###Subtasks  100 points : $Original Constraints$ ###Sample Input: 3 5 3 1 2 4 5 7 5 2 1 2 5 3 0 5 1 3 4 7 5 6 ###Sample Output: Happy New Year Happy New Year 1 ###EXPLANATION:  For Case 1: The array after performing the given operation is [4, 2, 4, 5, 4] and it gives a positive product.  For Case 2: The array after performing the given operation is [3, 2, 5, 3, 2] and it gives a positive product. *Note: There can be many ways to perform the operation in order to obtain a positive product.*  For Case 3: The product is negative even after performing the operation in any manner.Author:  pratiklath 
Tags  pratiklath 
Date Added:  24122019 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 