report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Positive subarray - MarisaOJ: Marisa Online Judge

Positive subarray

Time limit: 1000 ms
Memory limit: 256 MB
You are given an integer array $A$ of length $n$. Find the length of the longest subarray that contains only positive values. In other words, find the maximum value $j - i + 1$ such that $a_k > 0$ for each index $i \le k \le j$. ### Input - The first line contains an integers $n$. - The second line contains $n$ integers $A_i$. ### Output - Print the length of longest possible subarray. ### Constraints - $1 \le n \le 1000$. - $|A_i| \le 1000$. ### Example Input: ``` 6 -1 -2 3 4 2 -2 ``` Output: ``` 3 ```
Array
Even elements
Smallest value
Average
Array reversal
Negative and positive
Consecutive differences
Largest value
Positive and negative
Dominant element
Second largest
Maximum product
Array rotation
Palindrome array
Circle
Insert
Positive subarray
Sorting
Similar Arrays
Unique
Unique 2
Frequent value
Most Frequent Value
Bitonic sequence
Swap
Topic
Basic
Rating 800
Solution (0) Solution