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

Pianino

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

의견: 0

설명

\(6^{th}\) round, February \(6^{th}\) 2016
Young Mirka is an amateur musician. She plays the mul\(ti-pi\)ano. A mul\(ti-pi\)ano consists of an infinite
number of mul\(ti-ke\)ys, denoted with integers that can be interpreted as the pitch. A mul\(ti-co\)mposition
(a composition written for a mul\(ti-pi\)ano) can be represented with a finite array of integers, where
integers denote the order of mul\(ti-ke\)ys to press in order to play the mul\(ti-co\)mposition.
Young Mirka has heard a mul\(ti-co\)mposition on the mul\(ti-ra\)dio and now she wants to play it. Unfor-
tunately, she cannot hear exactly which key was pressed, but instead she can hear whether the pressed
mul\(ti-ke\)y was higher, lower or equal to the previously played key (a higher key is denoted with a larger
number). Therefore she has decided to play the composition in the following way:
• before playing, she will choose one n\(on-ne\)gative integer \(K\)
• in the beginning, she will play the correct mul\(ti-ke\)y (her mul\(ti-te\)acher told her which mul\(ti-ke\)y
that is)
• when she hears that the mul\(ti-ke\)y played in the mul\(ti-co\)mposition is higher than the previous
mul\(ti-ke\)y played in the mul\(ti-co\)mposition, she will play the mul\(ti-ke\)y denoted with the integer
larger than the mul\(ti-ke\)y she played previously by \(K\)
• analogously, when she hears that the mul\(ti-ke\)y played in the mul\(ti-co\)mposition is lower than the
previous mul\(ti-ke\)y played in the mul\(ti-co\)mposition, she will play the mul\(ti-ke\)y denoted with the
integer smaller than the mul\(ti-ke\)y she played previously by \(K\)
• when she hears that the mul\(ti-ke\)y played in the mul\(ti-co\)mposition is equal to the previous
mul\(ti-ke\)y played in the mul\(ti-co\)mposition, she will repeat the mul\(ti-ke\)y she played previously
Notice that, when Mirka is playing, she does not compare the pitch of the keys she played to the pitch
of the keys from the composition.
Help Mirka choose the integer \(K\) in order to hit as many correct pitches as possible.

제약
입력 형식

The first line of input contains the integer \(N\) (2 ⩽\(N\)\(10^{6}\)), the number of mul\(ti-ke\)ys in the multi-
composition on the mul\(ti-ra\)dio.
The second line of input contains \(N\) integers \(a@@RISE_MATH_BLOCK_0@@i\)\(10^{9}\)), the mul\(ti-ke\)ys played in the
mul\(ti-co\)mposition.

출력 형식

The first line of output must contain the maximum number of mul\(ti-ke\)ys that Mirka can play correctly.
The second line of output must contain the n\(on-ne\)gative number \(K\) that Mirka must choose in order
to hit as many correct pitches as possible. The number must be smaller than or equal to \(2 \cdot 10^{9}\).
Please note: The required number does not have to be unique, but will surely exist within the given
constraints.

예제 1
입력
5
1 2 0 3 1
7
2 1 -6 -2 1 6 10
출력
output
3
2
5
4
설명

Clarification of the first example: Mirka will play the following keys, respectively: 1, 2, 0, 3, 1. Denoted
in bold are the keys that she played correctly.
Clarification of the second example: Mirka will play the following keys, respectively: 2, -2, -6, -2, 2, 6,
10.

문제 정보

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

출처 COCI 2015/2016 Contest 6

평가 및 의견

Pianino

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

Log in to rate problems.

개별 의견

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

풀이 제출

Pianino

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