#1058
Unrated
ZIMA
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Bruno Rahle

In the old times, when dragons ruled the land, air temperature never fell below zero degrees. But after dragons left, nice and warm times went with them. We say that day is a winter day when average temperature for that day is below zero. We say that T consecutive winter days form a winter period of length T. There are some people that annoy everyone by rambling on about some winter that is coming. So a law had to be made, stating that you are allowed to say that winter is coming at most 2T days before a winter period of length T. Exception to this is only the winter period with the longest length, that can be announced at most 3T days before it begins. During some winter period, you can’t say that this period is coming, since it’s already here, but you can announce future winter periods according to the rules above. If there are more than one winter periods with the longest length, then only one is chosen and 3T days rule is applied only to that period. Knowing expected temperatures for some time period, find out the maximum number of days during which it is allowed to say that winter is coming.

입력

The first line of input contains the integer N (1 ≤ N ≤ 100 000), length of the overall time period we are considering. The following line contains N integers, temperatures of consecutive days in considered period. Absolute values of these integers won’t exceed 100.

출력

The first and only line of output should contain the maximum number of days during which it is allowed to announce the winter is coming.

예제 입력 1

8
1 -1 4 3 8 -2 3 -3

예제 출력 1

6

예제 입력 2

15
1 2 -1 2 3 4 5 6 1 4 8 3 -1 -2 1

예제 출력 2

8
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.