## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Split AND Sum CodeChef Solution | CodeChef Problem Solution 2022

You are given an array $\left[{A}_{1},\dots ,{A}_{N}\right]$. You want to split it into several $\left(\ge 2\right)$ subarrays so that the following condition holds:

• Calculate the sum of elements in each subarray. Then, the AND of all these sums is nonzero, where AND denotes the bitwise AND operation.

Determine if it's possible. If it's possible, find one such split. You don't

have to minimize the number of subarrays.

### Input Format

• The first line of the input contains a single integer $T$ $-$ the number of test cases. The description of the test cases follows.
• The first line of each test case contains a single integer $N$ $-$ the length of the array.

• The second line of each test case contains $N$ space-separated integers ${A}_{1},{A}_{2},\dots ,{A}_{N}$.

### Output Format

For each test case, if it's not possible to split the array so that the condition from the statement holds, output NO.

Otherwise, output YES. In the next line, output $K$ ($2\le K\le N$$-$ the number of subarrays you are splitting into.

In the $i$-th of the next $K$ lines, output two integers ${L}_{i},{R}_{i}$ ($1\le {L}_{i}\le {R}_{i}\le N$), where $\left[{L}_{i},{R}_{i}\right]$ denotes the $i$-th subarray.

Each number from $1$ to $N$ has to appear in exactly one of the segments $\left[{L}_{i},{R}_{i}\right]$.

You can output each letter in either uppercase or lowercase. You can output any solution. You don't have to minimize $K$.

### Constraints

• $1\le T\le {10}^{5}$
• $2\le N\le {10}^{5}$
• $0\le {A}_{i}<{2}^{30}$
• Sum of $N$ over all test cases doesn't exceed