Олимпиадный тренинг

Задача 39077. Threes - 05


Задача

Темы: ЕГЭ
The file contains a sequence of integers. Sequence elements can take integer values ​​from -15000 to 15000 inclusive. Determine the number of triples in the sequence in which the second element is greater than both of its neighbors, and the sum of the numbers in the triple has the same sign as the sum of all the numbers. In your answer, write down the  number of triples found, then the maximum of the sums of the elements of such  triples (two numbers separated by a space in one line) . In this task, under  a triple means three consecutive elements of a sequence.

Assignment file