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

Mean Sequence

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

의견: 0

설명

Task: MEA
Mean Sequence
Saturday, 20–08–2005
Available memory: 16 MB. Maximum running time: 5 s.
Consider a nondecreasing sequence of integers s1,...,sn+1 (si ≤si+1 for 1 ≤i ≤n). The sequence m1,...,mn
defined by mi = 1
2(si +si+1), for 1 ≤i ≤n, is called the mean sequence of sequence s1,...,sn+1. For example,
the mean sequence of sequence 1, 2, 2, 4 is the sequence 1.5, 2, 3. Note that elements of the mean sequence
can be fractions. However, this task deals with mean sequences whose elements are integers only.
Given a nondecreasing sequence of n integers m1,...,mn, compute the number of nondecreasing se-
quences of n +1 integers s1,...,sn+1 that have the given sequence m1,...,mn as mean sequence.
Task
Write a program that:
• reads from the standard input a nondecreasing sequence of integers,
• calculates the number of nondecreasing sequences, for which the given sequence is mean sequence,
• writes the answer to the standard output.

Example

For the input data:
3
2
5
9
the correct result is:
4
Indeed, there are four nondecreasing integer sequences for which 2,5,9 is the mean sequence. These se-
quences are:
• 2,2,8,10,
• 1,3,7,11,
• 0,4,6,12,
• −1,5,5,13.
v. 1.04
1/1
Mean Sequence

Note (RiseOJ) — The original statement describes file-based input/output; on this judge your program must read from standard input and write to standard output instead.

제약
입력 형식

The first line of the standard input contains one integer n (2 ≤n ≤5000000). The remaining n lines contain
the sequence m1,...,mn. Line i + 1 contains a single integer mi (0 ≤mi ≤1000000000). You can assume
that in 50% of the test cases n ≤1000 and 0 ≤mi ≤20000.

출력 형식

Your program should write to the standard output exactly one integer — the number of nondecreasing integer
sequences, that have the input sequence as the mean sequence.

문제 정보

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

출처 IOI 2005

평가 및 의견

Mean Sequence

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

Log in to rate problems.

개별 의견

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

풀이 제출

Mean Sequence

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