Logo
(追記) (追記ここまで)

14991번 - Disastrous Doubling 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB58917614228.980%

문제

A scientist, E. Collie, is going to do some experiments with bacteria. Right now, she has one bacterium. She already knows that this species of bacteria doubles itself every hour. Hence, after one hour there will be 2 bacteria. E.

E. Collie will do one experiment every hour, for n consecutive hours. She starts the first experiment exactly one hour after the first bacterium starts growing. In experiment i she will need bi bacteria.

How many bacteria will be left directly after starting the last experiment? If at any point there are not enough bacteria to do the experiment, print “error”.

Since the answer may be very large, please print it modulo 109 + 7.

입력

The input consists of two lines.

  • The first line contains an integer 1 ≤ n ≤ 105, the number of experiments.
  • The second line contains n integers b1, . . . , bn, where 0 ≤ bi ≤ 260 is the number of bacteria used in the ith experiment.

출력

Output a single line containing the number of bacteria that remains after doing all the experiments, or “error”.

제한

예제 입력 1

3
0 0 0

예제 출력 1

8

예제 입력 2

5
1 1 1 1 1

예제 출력 2

1

예제 입력 3

5
0 2 2 4 0

예제 출력 3

0

예제 입력 4

5
0 2 2 4 1

예제 출력 4

error

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2017 Preliminaries D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /