Dãy số #4

View as PDF

Submit solution

Points: 100.00 (partial)
Time limit: 1.0s
Memory limit: 102M
Input: stdin
Output: stdout

Author:
Problem type

Nhập vào dãy ~A~ có ~n~ phần tử. Tính đoạn con dài nhất chứa các phần tử âm dương đan xen nhau trong dãy ~A~

Input
  • Số nguyên dương ~n~ ~(1 \leq n \leq 1000)~
  • ~n~ số nguyên ~a_1,a_2,...,a_n~ ~(-10^6 \leq a_i \leq 10^6)~
Output
  • In ra độ dài của đoạn con tìm được
Example

Input

8
1 2 2 -2 3 -4 3 3

Output

5

Comments

Please read the guidelines before commenting.


There are no comments at the moment.