RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00216

Zima

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(4^{th}\) round, February \(18^{th}\), 2012

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.

제약

In test cases worth 40% of total points, there will be only one winter period with the longest length.

입력 형식

The first line of input contains the integer N (\(1 \le N \le 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
출력
6
예제 2
입력
15
1 2 -1 2 3 4 5 6 1 4 8 3 -1 -2 1
출력
8

First sample description: There are three winter periods of length one. In order to obtain the
requested maximum, best thing to do is to choose the second one to apply the 3T days rule, and
starting announcing it three days before it arrives.

Day
1.
2.
3.
4.
5.
6.
7.
8.
Temperature
1
-1
4
3
8
-2
3
-3
Winter
no
yes
no
no
no
yes
no
yes
Winter is coming
yes
no
yes
yes
yes
yes
yes
no
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2011/2012 Contest 4

평가 및 의견

Zima

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Zima

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8