#CCBOTPBA0000017. Độ dài đoạn dấu dương (Length of a Positive Segment)
Độ dài đoạn dấu dương (Length of a Positive Segment)
Length of a Positive Segment
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given n integers, a positive run is a contiguous segment of values strictly greater than zero. Print its maximum length; print zero for an empty sequence or no positive values.
Input
Integer n, then exactly n integers.
Output
The maximum length of a positive run.
Subtasks
-
Subtask 1 (20%):
n ≤ 20;|a_i| ≤ 1000000000. -
Subtask 2 (30%):
n ≤ 1000;|a_i| ≤ 1000000000. -
Subtask 3 (50%):
n ≤ 100000;|a_i| ≤ 1000000000.
Examples
Example 1
Input:
7
1 2 -1 4 5 6 0
Output:
3
Explanation: The run 4,5,6 is the longest, of length three.
Example 2
Input:
0
Output:
0
Explanation: There is no positive run.