This post is all about the solution of the "C1. Make Nonzero Sum (easy version)" Codeforces Round #829 (Div. 2) Problem Statement.

Codeforces logo

Codeforces



Problem Statement :

Users are provided an array [b1,b2,...bm] of integers 1 and -1. Users must create a separation of this array into the following components: [q1,l1], [q2,l2],..., [qk,lk].

The oscillating sum of all components of the i-th section is denoted as si: si = aliali+1+ali+2ali+3+...ari. For instance, the oscillating sum of portion [2,4] elements in array [1,0,1,1,1] equals 0(1)+1=2.
The sum of si over in all separation sections ought to be zero.
It should be noted that each si does not have to be equal to zero; this estate is about the total amount of si over all separation sections.


Format of Input :

Evey test contains a number of tests. The first category represents the number t (1t10000) of tests. The testing phase are characterised below.

Evey test case starts with just a numeric n (1n200000) — the distance of the element a.



Evey test case's second sentence includes n integer value a1,a2,...,an (ai is 1 or 1) — the aspects of the array.



The total amount of n over in all test cases is assured not to surpass 200000.


Format of the Output :

If the requisite partition doesn't really arise for each testing ground, print 1. Or else, publish a numeric k indicating the amount of partition sections.

Then, inside the i-th of the next k lines, systems integer values li and ri — the i-th segment characterization. This same conditions that must be met include.


Also Check this out:-


A. Technical Support Codeforces Round #829 (Div. 2) Problem Solution Click Here
B. Kevin and Permutation Codeforces Round #829 (Div. 2) Problem Solution Click Here
C1. Make Nonzero Sum (easy version) Codeforces Round #829 (Div. 2) Problem Solution Click Here
C2. Make Nonzero Sum (hard version) Codeforces Round #829 (Div. 2) Problem Solution Click Here



Also Read :- Top Programming Languages of 2022 Click Here

Solution of the Problem: Click Here