John has made an array of numbers which are important to him. Unfortunately, John lost the array.
Luckily, he knows some details about the array. You will receive each of these sets of details (which are lists of 3 integers).
Each detail is the sum of a section of the list. Each has the numbers
a, the starting index of the sum,
b, the ending index of the array's sum, and
c, which is 1 if the sum is positive and -1 if the sum is negative.
Your job is to find an array that matches the given details and to print them out, or to print
-1 if no such array exists.
Example Input: (0-indexed and inclusive)
[0, 1, 1] [1, 2, -1]
[-1, 2, -3]
The details here require that the sum from
1 is positive, and from
2 is negative. You can output any array that matches.
You can take the input in any reasonable format.
Whoever writes the shortest program wins! This is a code golf problem.