CF1753A1 Make Nonzero Sum (easy version)
题目描述
本题目是[CF1753A2](https://www.luogu.com.cn/problem/CF1753A2)的简单版本,不同之处为困难(hard)版本中$a$数组包含$0$。
**题目大意**
给你一个数组 $[a_1,a_2,...a_n]$ ,其中每一项 $a_i$ 都为 $1$ 或 $-1$ ,你需要构造一个划分 $[l_1,r_1],[l_2,r_2],[l_3,r_3],...[l_k,r_k]$ 使得:
- 将每一个区间内的数按照以下方法计算出$s_i=a_{l_i}-a_{l_i+1}+a_{l_i+2}-a_{l_i+3}+...\pm a_{r_i}$
- 对于一个合法的划分,所有的 $s_i$ 之和为 $0$
如果存在这样的划分,输出任何一个,否则输出 `-1` ,代表无解。
称一组区间 $[l_1,r_1],[l_2,r_2],[l_3,r_3],...[l_k,r_k]$ 为数组 $[a_1,a_2,...a_n]$ 的划分当且仅当 $1=l_1\leq r_1,l_2\leq r_2,l_3\leq r_3,...,,l_k\leq r_k = n$ 且对于 $1\leq i \leq k-1$ ,均有 $r_i+1=l_{i+1}$
注意在本题中,你不需要最小化 $k$。
输入格式
无
输出格式
无
说明/提示
In the first test case we can build a partition of one segment of length $ 4 $ . The sum of this segment will be equal to $ 1 - 1 + 1 - 1 = 0 $ .
In the second test case we can build a partition of two segments of length $ 3 $ . The sum of the first segment will be equal to $ -1 -1 + 1 = -1 $ , and the sum of the second segment: $ 1 - 1 + 1 = 1 $ . So, the total sum will be equal to $ -1 + 1 = 0 $ .
In the third and in the fourth test cases it can be proved that there are no required partition.