Company: Sprinklr
Difficulty: medium
Given an array A of size N which contains long integer values. For an index i of the array A , you need to calculate 2 values: Value1 : Sum of all values at index j such that j < i and A[j] < A[i] . Value2 : Count of total indices j such that j < i and A[j] > A[i] . You define the sum for index i as Value1 + (Value2 × A[i]) . Now, for each index i , if the sum is even, output 1 , else output 0 . Note: Assume 1-based indexing. Input Format The first line contains T , which represents the number of test cases. For each test case: The first line contains an input N . The second line contains an array of size N containing long integer values. Output Format For each test case in a new line, print the array. The element at the i th index of the array is 1 / 0 depending on whether the sum is even/odd. Print the values of one test case space separated on a single line. Constraints 1 ≤ T ≤ 10 1 ≤ N ≤ 2 × 10 5 1 ≤ A[i] ≤ 10 18 The sum of N over all test