#C1843. Longest Productive Streak
Longest Productive Streak
Longest Productive Streak
You are given an integer N representing the number of days and an array P of N integers representing the productivity scores for each day. A productive streak is defined as a consecutive sequence of days during which the cumulative sum of the scores remains strictly positive (i.e. \(S > 0\), where \(S = \sum_{i=1}^{k} P[i]\)). Whenever the cumulative sum becomes non-positive, the streak resets to zero. Your task is to determine the length of the longest productive streak.
Note: If no such streak exists, output 0.
inputFormat
The first line contains an integer N representing the number of days. The second line contains N space-separated integers representing the productivity scores of each day.
outputFormat
Output a single integer representing the length of the longest productive streak.
## sample7
1 -2 3 10 -4 7 2
5