#K74727. Maximum Continuous Working Days
Maximum Continuous Working Days
Maximum Continuous Working Days
In this problem, you are given a work record for a month represented as a binary sequence. Each element can be either 1 (worked) or 0 (not worked). Your task is to determine the maximum number of consecutive days during which work was done.
Formally, let \(a_1, a_2, \dots, a_n\) be a binary sequence where \(a_i = 1\) indicates that work was done on the \(i\)-th day and \(a_i = 0\) indicates a day off. You are required to compute:
[ \max_{1 \leq i \leq n} \left{ \text{length of the longest contiguous subsequence of 1s} \right} ]
If no day of work is recorded, the answer is 0.
inputFormat
The input is read from standard input (stdin) and contains two lines:
- The first line contains one integer \(n\) (\(1 \leq n \leq 10^5\)), representing the number of days in the month.
- The second line contains \(n\) space-separated integers with each integer being either 0 or 1, representing the work record for each day.
outputFormat
Output to standard output (stdout) a single integer representing the maximum number of consecutive days worked.
## sample10
1 0 1 1 1 0 1 1 1 1
4
</p>